public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/56468] New: Clang exposes bug with unexpected forward-declaration of type_info
@ 2013-02-26 22:50 d.frey at gmx dot de
  2013-02-26 23:22 ` [Bug libstdc++/56468] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: d.frey at gmx dot de @ 2013-02-26 22:50 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56468
           Summary: Clang exposes bug with unexpected forward-declaration
                    of type_info
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.frey@gmx.de


The following program fails to compile with Clang++ 3.2:

#include <typeinfo>
#include <exception>

const char* get_name( const std::exception_ptr eptr )
{
  return eptr.__cxa_exception_type()->name();
}

int main() {}

The output in the shell is:

$ g++-4.7 -std=c++0x -O3 -Wall -Wextra t.cc -o t
$ clang++-3.2 -std=c++0x -O3 -Wall -Wextra t.cc -o t
t.cc:6:37: error: member access into incomplete type 'const class type_info'
  return eptr.__cxa_exception_type()->name();
                                    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/bits/exception_ptr.h:144:19:
note: forward declaration of
      'std::__exception_ptr::type_info'
      const class type_info*
                  ^
1 error generated.
$

The problem is that <typeinfo> includes <exception> before it forward-declares
std::type_info. In <exception>, type_info is used in the context of
std::__exception_ptr, thus Clang generates an implicit forward-declaration for
std::__exception_ptr::type_info and, when used in the above code, consequently
fails.

Further discussion has taken place at <http://stackoverflow.com/q/15098174>.


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

end of thread, other threads:[~2013-03-17 14:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26 22:50 [Bug libstdc++/56468] New: Clang exposes bug with unexpected forward-declaration of type_info d.frey at gmx dot de
2013-02-26 23:22 ` [Bug libstdc++/56468] " redi at gcc dot gnu.org
2013-02-27  7:36 ` jakub at gcc dot gnu.org
2013-02-27  9:34 ` redi at gcc dot gnu.org
2013-02-28 16:15 ` d.frey at gmx dot de
2013-03-16 20:02 ` redi at gcc dot gnu.org
2013-03-16 20:23 ` redi at gcc dot gnu.org
2013-03-16 20:24 ` redi at gcc dot gnu.org
2013-03-16 23:46 ` steven at gcc dot gnu.org
2013-03-17 11:36 ` jakub at gcc dot gnu.org
2013-03-17 14:11 ` redi at gcc dot gnu.org
2013-03-17 14:12 ` redi at gcc dot gnu.org

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).