From e23afa25113fb191e560862dc5f910eafe9f0d9b Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 29 May 1998 14:19:11 +0000 Subject: [PATCH] decl.c (grokdeclarator): Don't complain about in-class initialization of static consts if... * decl.c (grokdeclarator): Don't complain about in-class initialization of static consts if we don't really know the type of the variable. From-SVN: r20139 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 3 ++- gcc/testsuite/g++.old-deja/g++.pt/static4.C | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/static4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ea4e5fb1726..47725b2c7e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1998-05-29 Mark Mitchell + + * decl.c (grokdeclarator): Don't complain about in-class + initialization of static consts if we don't really know the type + of the variable. + 1998-05-29 Jason Merrill * cp-tree.h (DECL_DESTRUCTOR_P): New macro. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d61642c1402..e0d0119ee69 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10003,7 +10003,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) cp_error ("ANSI C++ forbids in-class initialization of non-const static member `%D'", declarator); - if (pedantic && ! INTEGRAL_TYPE_P (type)) + if (pedantic && ! INTEGRAL_TYPE_P (type) + && !uses_template_parms (type)) cp_pedwarn ("ANSI C++ forbids initialization of member constant `%D' of non-integral type `%T'", declarator, type); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static4.C b/gcc/testsuite/g++.old-deja/g++.pt/static4.C new file mode 100644 index 00000000000..2ff32215437 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/static4.C @@ -0,0 +1,8 @@ +// Build don't link: + +template +struct S +{ + static const T t = 3; +}; +