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
This commit is contained in:
parent
6a4e47783a
commit
2010cdcdd7
@ -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
|
||||
|
17
gcc/cp/pt.c
17
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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" }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user