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
This commit is contained in:
parent
2879ca2a89
commit
e23afa2511
@ -1,3 +1,9 @@
|
||||
1998-05-29 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* 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 <jason@yorick.cygnus.com>
|
||||
|
||||
* cp-tree.h (DECL_DESTRUCTOR_P): New macro.
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
8
gcc/testsuite/g++.old-deja/g++.pt/static4.C
Normal file
8
gcc/testsuite/g++.old-deja/g++.pt/static4.C
Normal file
@ -0,0 +1,8 @@
|
||||
// Build don't link:
|
||||
|
||||
template <class T>
|
||||
struct S
|
||||
{
|
||||
static const T t = 3;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user