]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (grokdeclarator): Don't complain about in-class initialization of static const...
authorMark Mitchell <mark@markmitchell.com>
Fri, 29 May 1998 14:19:11 +0000 (14:19 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 29 May 1998 14:19:11 +0000 (14:19 +0000)
* 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
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.pt/static4.C [new file with mode: 0644]

index ea4e5fb172631a1f29b0fa28329b00bd56e07840..47725b2c7e13edb7263175037f4b51f552967ec2 100644 (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.
index d61642c1402ff96d1bcf143f1669e6b6f8aa57c2..e0d0119ee69a11172516b467cb62e842e0016a71 100644 (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);
              }
 
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 (file)
index 0000000..2ff3221
--- /dev/null
@@ -0,0 +1,8 @@
+// Build don't link:
+
+template <class T>
+struct S
+{
+  static const T t = 3;
+};
+