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:
Mark Mitchell 1998-05-29 14:19:11 +00:00 committed by Mark Mitchell
parent 2879ca2a89
commit e23afa2511
3 changed files with 16 additions and 1 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -0,0 +1,8 @@
// Build don't link:
template <class T>
struct S
{
static const T t = 3;
};