Spinoff from PR 17344: ---------------------------------- template <typename T> struct intTraits { static const T i = 0; }; struct S { S(intTraits<void>); }; template <typename> struct A {}; int bar(S); int bar(A<int>); S *s; int i = bar(*s); ------------------------ We shouldn't ICE here: g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -c x.cc x.cc: In instantiation of `intTraits<void>': x.cc:15: instantiated from here x.cc:2: error: instantiation of `intTraits<void>::i' as type `const void' x.cc:2: error: `intTraits<void>::i' has incomplete type x.cc:2: error: invalid in-class initialization of static data member of non-integral type `<type error>' x.cc:1: internal compiler error: tree check: expected class 't', have 'x' (error_mark) in finish_struct_1, at cp/class.c:5065 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. W.
Here's something shorter: ============================== template<typename T> struct A { static const T i; }; A<void> a; ============================== We ICE since gcc 3.0.
Sorry, I meant of course: ============================= template<typename T> struct A { static const T i = 0; }; A<void> a; =============================
Subject: Bug 17524 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2004-10-09 17:33:02 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog cp-tree.h decl.c pt.c Added files: gcc/testsuite/g++.dg/parse: operator5.C gcc/testsuite/g++.dg/template: static9.C Log message: PR c++/17524 * cp-tree.h (check_var_type): New function. * decl.c (check_var_type): New function, split out from ... (grokdeclarator): ... here. * pt.c (tsubst_decl): Use check_var_type. PR c++/17685 * decl.c (grokdeclarator): Disallow declarations of operators as PR c++/17524 * g++.dg/template/static9.C: New test. PR c++/17685 * g++.dg/parse/operator5.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4419&r2=1.4420 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4415&r2=1.4416 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1058&r2=1.1059 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1311&r2=1.1312 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.933&r2=1.934 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/operator5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static9.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 17524 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-10-09 17:55:31 Modified files: gcc/cp : ChangeLog cp-tree.h decl.c pt.c Added files: gcc/testsuite/g++.dg/parse: operator5.C gcc/testsuite/g++.dg/template: static9.C Log message: PR c++/17524 * cp-tree.h (check_var_type): New function. * decl.c (check_var_type): New function, split out from ... (grokdeclarator): ... here. * pt.c (tsubst_decl): Use check_var_type. PR c++/17685 * decl.c (grokdeclarator): Disallow declarations of operators as non-functions. PR c++/17524 * g++.dg/template/static9.C: New test. PR c++/17685 * g++.dg/parse/operator5.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.164&r2=1.3892.2.165 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.946.4.16&r2=1.946.4.17 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.24&r2=1.1174.2.25 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.42&r2=1.816.2.43 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/operator5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static9.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed in GCC 3.4.3.