aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-05-29 14:19:11 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-05-29 14:19:11 +0000
commite23afa25113fb191e560862dc5f910eafe9f0d9b (patch)
tree2126e62126c844cfb208d2e591d905fcbc043a8d
parent2879ca2a89e81ec127e2accb87bd3884a78d6ad4 (diff)
downloadgcc-e23afa25113fb191e560862dc5f910eafe9f0d9b.zip
gcc-e23afa25113fb191e560862dc5f910eafe9f0d9b.tar.gz
gcc-e23afa25113fb191e560862dc5f910eafe9f0d9b.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/static4.C8
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ea4e5fb..47725b2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d61642c..e0d0119 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 0000000..2ff3221
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/static4.C
@@ -0,0 +1,8 @@
+// Build don't link:
+
+template <class T>
+struct S
+{
+ static const T t = 3;
+};
+