summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-10 09:40:18 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-10 09:40:18 +0000
commita15ce1f89ab59ebd3c1aa1f2203d8effaf91d46e (patch)
tree8403356905399ae2938106e41a80b9cb2a1bbec1
parentc966d6c3c6599f4cd0e3bf9090ff39f6ff51b4bd (diff)
downloadppe42-gcc-a15ce1f89ab59ebd3c1aa1f2203d8effaf91d46e.tar.gz
ppe42-gcc-a15ce1f89ab59ebd3c1aa1f2203d8effaf91d46e.zip
cp:
PR c++/5507 * decl.c (make_typename_type): Remove implicit typenameness. testsuite: PR c++/5507 * g++.dg/template/typename2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52124 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/typename2.C25
4 files changed, 46 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1f30899d935..a2d8b8f3943 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2002-04-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5507
+ * decl.c (make_typename_type): Remove implicit typenameness.
+
2002-04-09 Jason Merrill <jason@redhat.com>
PR optimization/6189
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 383991f0924..dc9d37313e7 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5699,6 +5699,17 @@ make_typename_type (context, name, complain)
{
if (DECL_ARTIFICIAL (t) || !(complain & tf_keep_type_decl))
t = TREE_TYPE (t);
+ if (IMPLICIT_TYPENAME_P (t))
+ {
+ /* Lookup found an implicit typename that we had
+ injected into the current scope. Doing things
+ properly would have located the exact same type,
+ so there is no error here. We must remove the
+ implicitness so that we do not warn about it. */
+ t = copy_node (t);
+ TREE_TYPE (t) = NULL_TREE;
+ }
+
return t;
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fae1c9bdd05..5e82ca50d4b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2002-04-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/5507
+ * g++.dg/template/typename2.C: New test.
+
2002-04-10 Alan Modra <amodra@bigpond.net.au>
* gcc.c-torture/execute/loop-12.c: New.
diff --git a/gcc/testsuite/g++.dg/template/typename2.C b/gcc/testsuite/g++.dg/template/typename2.C
new file mode 100644
index 00000000000..4a4e40fd6ce
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/typename2.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "" }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 21 Mar 2002 <nathan@codesourcery.com>
+
+// PR 5507. Overzealous implicit typename warning
+
+template<typename _CharT>
+class __ctype_abstract_base
+{
+ typedef int mask;
+};
+
+template<typename _CharT>
+class ctype : public __ctype_abstract_base<_CharT>
+{
+ typedef typename ctype::mask mask;
+};
+
+template<typename _CharT>
+class ctype2 : public __ctype_abstract_base<_CharT>
+{
+ typedef mask mask; // { dg-warning "(`typename )|(implicit typename)" "" }
+};
OpenPOWER on IntegriCloud