PR c++/21008, DR 515
PR c++/21008, DR 515 * semantics.c (finish_non_static_data_member): Don't check derivation in a template. From-SVN: r154150
This commit is contained in:
parent
fc1e08468e
commit
ab11c13ff3
|
@ -1,5 +1,9 @@
|
|||
2009-11-13 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/21008, DR 515
|
||||
* semantics.c (finish_non_static_data_member): Don't check
|
||||
derivation in a template.
|
||||
|
||||
PR c++/11987
|
||||
* parser.c (cp_parser_direct_declarator): Give helpful error about
|
||||
trying to define member of a dependent typedef.
|
||||
|
|
|
@ -1485,6 +1485,14 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
|
|||
|
||||
return build_min (COMPONENT_REF, type, object, decl, NULL_TREE);
|
||||
}
|
||||
/* If PROCESSING_TEMPLATE_DECL is nonzero here, then
|
||||
QUALIFYING_SCOPE is also non-null. Wrap this in a SCOPE_REF
|
||||
for now. */
|
||||
else if (processing_template_decl)
|
||||
return build_qualified_name (TREE_TYPE (decl),
|
||||
qualifying_scope,
|
||||
DECL_NAME (decl),
|
||||
/*template_p=*/false);
|
||||
else
|
||||
{
|
||||
tree access_type = TREE_TYPE (object);
|
||||
|
@ -1504,15 +1512,6 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
|
|||
}
|
||||
}
|
||||
|
||||
/* If PROCESSING_TEMPLATE_DECL is nonzero here, then
|
||||
QUALIFYING_SCOPE is also non-null. Wrap this in a SCOPE_REF
|
||||
for now. */
|
||||
if (processing_template_decl)
|
||||
return build_qualified_name (TREE_TYPE (decl),
|
||||
qualifying_scope,
|
||||
DECL_NAME (decl),
|
||||
/*template_p=*/false);
|
||||
|
||||
perform_or_defer_access_check (TYPE_BINFO (access_type), decl,
|
||||
decl);
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
2009-11-13 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/21008, DR 515
|
||||
* g++.dg/template/inherit4.C: New.
|
||||
* g++.dg/lookup/scoped8.C: Adjust.
|
||||
|
||||
PR c++/11987
|
||||
* g++.dg/parse/typename11.C: New.
|
||||
* g++.dg/template/crash48.C: Adjust.
|
||||
|
|
|
@ -14,3 +14,5 @@ template <int> struct B
|
|||
{
|
||||
int foo() { return A::i; } // { dg-error "this location" }
|
||||
};
|
||||
|
||||
template struct B<0>;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// PR c++/21008, DR 515
|
||||
|
||||
struct A {
|
||||
int foo_;
|
||||
};
|
||||
template <typename T> struct B: public A { };
|
||||
template <typename T> struct C: B<T> {
|
||||
int foo() {
|
||||
return A::foo_; // #1
|
||||
}
|
||||
};
|
||||
int f(C<int>* p) {
|
||||
return p->foo();
|
||||
}
|
Loading…
Reference in New Issue