g++43 -v output:

Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --program-suffix=43 --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.3.0 20070929 (experimental) (GCC)

Built from svn trunk, revision 128885

The following code fails to compile with this error:

canonical_type_error.cpp: In function 'int A::* getmemberptr()':
canonical_type_error.cpp:8: internal compiler error: canonical types differ for
identical types int A::* and int A::*

==========================
struct A
{
        int     membervar;
};

typedef const A type;

int type::* getmemberptr() { return &type::membervar; }
=========================

I'm not sure if the code is valid however (using such a typedef as the class id
in a pointer to member declaration), but it did work with older builds of gcc.

It also fails if type is a template argument, which makes it possible to
stumble on this problem in a non obvious way because of automatic template
argument deduction.


-- 
           Summary: [4.3 regression] ICE with pointers to members using
                    "const C" as the class identifier
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: a dot chavasse at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to