aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-09-16 15:41:45 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2005-09-16 15:41:45 +0000
commit2010cdcdd7bfd38c480fdffc147e875b7f277a70 (patch)
tree5f4499835199488c0191de94813c9caef0ece492 /gcc/cp/pt.c
parent6a4e47783a529fabc08694929bb74efa5b39f814 (diff)
downloadgcc-2010cdcdd7bfd38c480fdffc147e875b7f277a70.zip
gcc-2010cdcdd7bfd38c480fdffc147e875b7f277a70.tar.gz
gcc-2010cdcdd7bfd38c480fdffc147e875b7f277a70.tar.bz2
re PR c++/21514 ([DR 488] templates and anonymous enum)
PR c++/21514 * pt.c (check_instantiated_args): Treat uses of anonymous types as causing type-deduction failure. PR c++/21514 * g++.dg/template/crash19.C: Remove dg-error marker. * g++.dg/template/local4.C: New test. From-SVN: r104344
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c17
1 files changed, 10 insertions, 7 deletions
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;
}