This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/31905] New: ICE with typeof(&T::method2)


I get an ICE when instantiating the following template:

template <typename T>
typeof(&T::method2) method2_of(T) {
        return &T::method2;
}
Note that both '&' are needed, as well as instantiating this template on a 
type having a ::method2 member function. If I omit any of them, I get just 
various error messages.

==bug.cpp==
struct Foo
{
    void method2(int) {
    }
};

template <typename T>
typeof(&T::method2) method2_of(T) {
        return &T::method2;
}

int main() {
        Foo a;
        method2_of(a);
}
==end==

$ g++ -c bug.cpp
bug.cpp: In function ?__typeof__ (& T::method2) method2_of(T) [with T = Foo]?:
bug.cpp:9: internal compiler error: in write_type, at cp/mangle.c:1651
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccSj6aeQ.out file, please attach this to
your bugreport.

$ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --enable-checking=release
x86_64-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)

Command line of cc1plus:
// /usr/lib/gcc/x86_64-linux-gnu/4.1.2/cc1plus -quiet -D_GNU_SOURCE 
bug.cpp -quiet -dumpbase bug.cpp -mtune=generic -auxbase 
bug -fstack-protector -fstack-protector -o - -frandom-seed=0


-- 
           Summary: ICE with typeof(&T::method2)
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: blaisorblade_spam at yahoo dot it
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]