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.c17
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/template/crash19.C2
-rw-r--r--gcc/testsuite/g++.dg/template/local4.C5
5 files changed, 24 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 683af87..91dc405 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/21514
+ * pt.c (check_instantiated_args): Treat uses of anonymous types as
+ causing type-deduction failure.
+
2005-09-15 Jason Merrill <jason@redhat.com>
PR c++/23357
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ece9614..be2f031 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8967,7 +8967,6 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
{
int ix, len = DECL_NTPARMS (tmpl);
bool result = false;
- bool error_p = complain & tf_error;
for (ix = 0; ix != len; ix++)
{
@@ -8984,12 +8983,16 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
if (nt)
{
- if (TYPE_ANONYMOUS_P (nt))
- error ("%qT is/uses anonymous type", t);
- else
- error ("%qT uses local type %qT", t, nt);
+ /* DR 488 makes use of a type with no linkage causes
+ type deduction to fail. */
+ if (complain & tf_error)
+ {
+ if (TYPE_ANONYMOUS_P (nt))
+ error ("%qT is/uses anonymous type", t);
+ else
+ error ("%qT uses local type %qT", t, nt);
+ }
result = true;
- error_p = true;
}
/* In order to avoid all sorts of complications, we do not
allow variably-modified types as template arguments. */
@@ -9011,7 +9014,7 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
result = true;
}
}
- if (result && error_p)
+ if (result && (complain & tf_error))
error (" trying to instantiate %qD", tmpl);
return result;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0a3744..6103389 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-16 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/21514
+ * g++.dg/template/crash19.C: Remove dg-error marker.
+ * g++.dg/template/local4.C: New test.
+
2005-09-16 Paul Brook <paul@codesourcery.com>
PR fortran/23906
diff --git a/gcc/testsuite/g++.dg/template/crash19.C b/gcc/testsuite/g++.dg/template/crash19.C
index 59b4140..a28827f 100644
--- a/gcc/testsuite/g++.dg/template/crash19.C
+++ b/gcc/testsuite/g++.dg/template/crash19.C
@@ -9,7 +9,7 @@ template <class T>
struct X {
enum { SIXTY_FOUR=64 };
struct node {
- unsigned char *ptr[sizeof(T)*SIXTY_FOUR]; // { dg-error "" }
+ unsigned char *ptr[sizeof(T)*SIXTY_FOUR];
void d() {}
};
node *head;
diff --git a/gcc/testsuite/g++.dg/template/local4.C b/gcc/testsuite/g++.dg/template/local4.C
index 20f8bf2..cfa3736 100644
--- a/gcc/testsuite/g++.dg/template/local4.C
+++ b/gcc/testsuite/g++.dg/template/local4.C
@@ -4,8 +4,5 @@ template <typename T> void foo() {}
int main () {
struct S {};
- // We do not simply use "local|match" on line 10 because we want to
- // make sure that "local" appears.
- // { dg-error "local" "local" { target *-*-* } 10 }
- foo<S> (); // { dg-error "trying|match" }
+ foo<S> (); // { dg-error "match" }
}