aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmitchel <>2005-10-18 14:39:12 +0000
committermmitchel <>2005-10-18 14:39:12 +0000
commit533257093b4e45703ba97cd8c335f91015434976 (patch)
tree8aa991c7af90fad053fc0468b9ab54c0156ba49a
parent288608c04479a86c5c50b51d24c56262f1e1b2e4 (diff)
PR c++/23293
* pt.c (convert_template_argument): Use canonical type variants in template specializations. PR c++/23293 * g++.dg/template/error19.C: New test.
-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 42dc317095d..4c79e894de7 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 d25130a078d..62db1229b21 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 54122c1dbab..f2123589f84 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 00000000000..d533e9a3b98
--- /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 > >();
+}