[Bug c++/41752] New: Canonical type with variadic templates and CRTP
CRTP does not seem to work together with variadic templates. On a larger program, type canonization seems to be faulty and leads to a g++ crash. Source code: struct a {}; template < typename T, typename ENCLOSING > struct base; template < typename ENCLOSING > struct base< a, ENCLOSING > {}; template < typename... T > struct derived : public base< T, derived< T... > >... {}; int main() { derived< a > instance; base< a, derived< a > >& a_instance = instance; } Output of g++ variadic-crtp.cc -std=c++0x: variadic-crtp.cc: In function 'int main()': variadic-crtp.cc:18:41: error: invalid initialization of reference of type 'base >&' from expression of type 'derived' Output of g++ -v: Using built-in specs. Target: i386-apple-darwin9 Configured with: ../gcc-4.5-20091001/configure --prefix=/opt/local --build=i386-apple-darwin9 --enable-languages=c,c++,objc,obj-c++ --libdir=/opt/local/lib/gcc45 --includedir=/opt/local/include/gcc45 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.5 --with-gxx-include-dir=/opt/local/include/gcc45/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local Thread model: posix gcc version 4.5.0 20091001 (experimental) (GCC) -- Summary: Canonical type with variadic templates and CRTP Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: alban dot linard at gmail dot com GCC build triplet: i686-apple-darwin9 GCC host triplet: i686-apple-darwin9 GCC target triplet: i686-apple-darwin9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41752
[Bug c++/41785] New: ICE on canonical types with variadic templates and CRTP
Source code below makes an ICE: g++-mp-4.5 -std=c++0x bug.cc bug.cc: In instantiation of 'derived': bug.cc:20:16: instantiated from here bug.cc:9:1: internal compiler error: canonical types differ for identical types derived and derived Source: struct a {}; template < typename T, typename ENCLOSING > struct base; template < typename... T > struct derived : public base< T, derived< T... > >... {}; template < typename... T> struct base< a, derived< T... > > { typedef derived< T... > Derived; }; int main() { derived< a > instance; } g++-mp-4.5 -v Using built-in specs. Target: i386-apple-darwin9 Configured with: ../gcc-4.5-20091001/configure --prefix=/opt/local --build=i386-apple-darwin9 --enable-languages=c,c++,objc,obj-c++ --libdir=/opt/local/lib/gcc45 --includedir=/opt/local/include/gcc45 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.5 --with-gxx-include-dir=/opt/local/include/gcc45/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local Thread model: posix gcc version 4.5.0 20091001 (experimental) (GCC) -- Summary: ICE on canonical types with variadic templates and CRTP Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: alban dot linard at gmail dot com GCC build triplet: i386-apple-darwin9 GCC host triplet: i386-apple-darwin9 GCC target triplet: i386-apple-darwin9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41785
[Bug c++/41785] [4.5 Regression] ICE on canonical types with variadic templates and CRTP
--- Comment #2 from alban dot linard at gmail dot com 2009-10-22 14:20 --- Seems related to bug #41752 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41785