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>
|
2005-09-15 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/23357
|
PR c++/23357
|
||||||
|
|
|
@ -8967,7 +8967,6 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
|
||||||
{
|
{
|
||||||
int ix, len = DECL_NTPARMS (tmpl);
|
int ix, len = DECL_NTPARMS (tmpl);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
bool error_p = complain & tf_error;
|
|
||||||
|
|
||||||
for (ix = 0; ix != len; ix++)
|
for (ix = 0; ix != len; ix++)
|
||||||
{
|
{
|
||||||
|
@ -8983,13 +8982,17 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
|
||||||
tree nt = no_linkage_check (t, /*relaxed_p=*/false);
|
tree nt = no_linkage_check (t, /*relaxed_p=*/false);
|
||||||
|
|
||||||
if (nt)
|
if (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))
|
if (TYPE_ANONYMOUS_P (nt))
|
||||||
error ("%qT is/uses anonymous type", t);
|
error ("%qT is/uses anonymous type", t);
|
||||||
else
|
else
|
||||||
error ("%qT uses local type %qT", t, nt);
|
error ("%qT uses local type %qT", t, nt);
|
||||||
|
}
|
||||||
result = true;
|
result = true;
|
||||||
error_p = true;
|
|
||||||
}
|
}
|
||||||
/* In order to avoid all sorts of complications, we do not
|
/* In order to avoid all sorts of complications, we do not
|
||||||
allow variably-modified types as template arguments. */
|
allow variably-modified types as template arguments. */
|
||||||
|
@ -9011,7 +9014,7 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result && error_p)
|
if (result && (complain & tf_error))
|
||||||
error (" trying to instantiate %qD", tmpl);
|
error (" trying to instantiate %qD", tmpl);
|
||||||
return result;
|
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>
|
2005-09-16 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
PR fortran/23906
|
PR fortran/23906
|
||||||
|
|
|
@ -9,7 +9,7 @@ template <class T>
|
||||||
struct X {
|
struct X {
|
||||||
enum { SIXTY_FOUR=64 };
|
enum { SIXTY_FOUR=64 };
|
||||||
struct node {
|
struct node {
|
||||||
unsigned char *ptr[sizeof(T)*SIXTY_FOUR]; // { dg-error "" }
|
unsigned char *ptr[sizeof(T)*SIXTY_FOUR];
|
||||||
void d() {}
|
void d() {}
|
||||||
};
|
};
|
||||||
node *head;
|
node *head;
|
||||||
|
|
|
@ -4,8 +4,5 @@ template <typename T> void foo() {}
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
struct S {};
|
struct S {};
|
||||||
// We do not simply use "local|match" on line 10 because we want to
|
foo<S> (); // { dg-error "match" }
|
||||||
// make sure that "local" appears.
|
|
||||||
// { dg-error "local" "local" { target *-*-* } 10 }
|
|
||||||
foo<S> (); // { dg-error "trying|match" }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue