diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 445c23c..63a7b92 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13538,37 +13538,28 @@ xref_tag_1 (enum tag_types tag_code, tree name, processing a (member) template declaration of a template class, we must be very careful; consider: - template <class X> - struct S1 + template <class X> struct S1 - template <class U> - struct S2 - { template <class V> - friend struct S1; }; + template <class U> struct S2 + { + template <class V> friend struct S1; + }; Here, the S2::S1 declaration should not be confused with the outer declaration. In particular, the inner version should - have a template parameter of level 2, not level 1. This - would be particularly important if the member declaration - were instead: - - template <class V = U> friend struct S1; + have a template parameter of level 2, not level 1. - say, when we should tsubst into `U' when instantiating - S2. On the other hand, when presented with: + On the other hand, when presented with: - template <class T> - struct S1 { - template <class U> - struct S2 {}; - template <class U> - friend struct S2; + template <class T> struct S1 + { + template <class U> struct S2 {}; + template <class U> friend struct S2; }; - we must find the inner binding eventually. We - accomplish this by making sure that the new type we - create to represent this declaration has the right - TYPE_CONTEXT. */ + the friend must find S1::S2 eventually. We accomplish this + by making sure that the new type we create to represent this + declaration has the right TYPE_CONTEXT. */ context = TYPE_CONTEXT (t); t = NULL_TREE; } @@ -13622,9 +13613,10 @@ xref_tag_1 (enum tag_types tag_code, tree name, return error_mark_node; } - /* Make injected friend class visible. */ if (scope != ts_within_enclosing_non_class && TYPE_HIDDEN_P (t)) { + /* This is no longer an invisible friend. Make it + visible. */ tree decl = TYPE_NAME (t); DECL_ANTICIPATED (decl) = false; |