aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/error19.C22
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 42dc317..4c79e89 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-18 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/23293
+ * pt.c (convert_template_argument): Use canonical type variants in
+ template specializations.
+
2005-10-18 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21383
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d25130a..62db122 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3930,6 +3930,13 @@ convert_template_argument (tree parm,
}
else
val = arg;
+ /* We only form one instance of each template specialization.
+ Therefore, if we use a non-canonical variant (i.e., a
+ typedef), any future messages referring to the type will use
+ the typedef, which is confusing if those future uses do not
+ themselves also use the typedef. */
+ if (TYPE_P (val))
+ val = canonical_type_variant (val);
}
else
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 54122c1..f212358 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-10-18 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/23293
+ * g++.dg/template/error19.C: New test.
+
2005-10-18 Nathan Sidwell <nathan@codesourcery.com>
PR c++/21383
diff --git a/gcc/testsuite/g++.dg/template/error19.C b/gcc/testsuite/g++.dg/template/error19.C
new file mode 100644
index 0000000..d533e9a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error19.C
@@ -0,0 +1,22 @@
+// PR c++/23293
+
+template < typename > struct P;
+struct S;
+
+void *unrelated_function()
+{
+ typedef S K;
+ P < K > * p;
+ return p;
+}
+
+template < typename U >
+void generate_warning()
+{
+ U::x(); // { dg-error "P<S>" }
+}
+
+int main()
+{
+ generate_warning< P < S > >();
+}