public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/56282] New: [4.8 regression] std::basic_ios<char> broken with -std=c++11 (undefined reference)
@ 2013-02-11  2:54 daniel at constexpr dot org
  2013-02-11  7:44 ` [Bug libstdc++/56282] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: daniel at constexpr dot org @ 2013-02-11  2:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56282

             Bug #: 56282
           Summary: [4.8 regression] std::basic_ios<char> broken with
                    -std=c++11 (undefined reference)
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel@constexpr.org


Simple enough:

$ echo -e '#include <iostream>\n int main() { std::cout << "Hello World!\\n";
return bool(std::cout); }' | g++-4.8.0-pre9999 -x c++ - -std=c++11
/tmp/cc4QaOVU.o: In function `main':
:(.text+0x19): undefined reference to `std::basic_ios<char,
std::char_traits<char> >::operator bool() const'
collect2: error: ld returned 1 exit status

Broken by this commit:
http://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9d8eb68081f898e225727d69da8212813f27e199

The offending commit adds the correct test operator for C++11:

+#if __cplusplus >= 201103L
+      explicit operator bool() const
+      { return !this->fail(); }
+#else
       operator void*() const
       { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
+#endif

However, std::basic_ios<char> is explicitly instantiated in libstdc++.so (from
basic_ios.tcc):
#if _GLIBCXX_EXTERN_TEMPLATE
  extern template class basic_ios<char>;

#ifdef _GLIBCXX_USE_WCHAR_T
  extern template class basic_ios<wchar_t>;
#endif
#endif

So the gcc doesn't instantiate explicit operator bool for std::basic_ios<char>
and instead tries to use the instantiation in libstdc++.so, which only has the
operator void*.


$ g++-4.8.0-pre9999 -v
Using built-in specs.
COLLECT_GCC=g++-4.8.0-pre9999
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0-pre9999/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.8.0_pre9999/work/gcc-4.8.0-9999/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0-pre9999
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0-pre9999/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0-pre9999
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0-pre9999/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.0-pre9999/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.0-pre9999/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check
--with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.0-pre9999/python
--enable-checking=release --disable-libgcj --enable-libstdcxx-time
--enable-languages=c,c++,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.0_pre9999'
Thread model: posix
gcc version 4.8.0-pre9999 20130211 (experimental) commit
37db34b1d053392f4d8899178a7f647bb70f400e (Gentoo 4.8.0_pre9999)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-02-11 10:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11  2:54 [Bug libstdc++/56282] New: [4.8 regression] std::basic_ios<char> broken with -std=c++11 (undefined reference) daniel at constexpr dot org
2013-02-11  7:44 ` [Bug libstdc++/56282] " rguenth at gcc dot gnu.org
2013-02-11  9:04 ` jakub at gcc dot gnu.org
2013-02-11  9:53 ` redi at gcc dot gnu.org
2013-02-11 10:03 ` redi at gcc dot gnu.org
2013-02-11 10:09 ` paolo.carlini at oracle dot com
2013-02-11 10:31 ` paolo at gcc dot gnu.org
2013-02-11 10:33 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).