mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-05 08:05:24 +02:00
Bug 484162 - Instantiation of friend of nested class inside template
Change-Id: I28377e20ce63c3e22ea561a98773e73484edf09a Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
parent
6a9dccd2b0
commit
d74ee1a89c
2 changed files with 28 additions and 5 deletions
|
@ -8691,6 +8691,27 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
public void testStrayFriends_419301() throws Exception {
|
public void testStrayFriends_419301() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename>
|
||||||
|
// struct A {
|
||||||
|
// struct B {
|
||||||
|
// friend B foo(B, long);
|
||||||
|
// friend long foo(B, B);
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// void waldo(T);
|
||||||
|
//
|
||||||
|
// A<int>::B c;
|
||||||
|
// A<int>::B d;
|
||||||
|
//
|
||||||
|
// void test() {
|
||||||
|
// waldo(foo(c, d)); // problem on waldo
|
||||||
|
// }
|
||||||
|
public void testInstantiationOfFriendOfNestedClassInsideTemplate_484162() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
// template <typename T>
|
// template <typename T>
|
||||||
// constexpr T t(T) {
|
// constexpr T t(T) {
|
||||||
|
|
|
@ -805,16 +805,18 @@ public class CPPSemantics {
|
||||||
// * ... types of the template arguments for template type parameters
|
// * ... types of the template arguments for template type parameters
|
||||||
// (excluding template template parameters);
|
// (excluding template template parameters);
|
||||||
// * ... owners of which any template template arguments are members;
|
// * ... owners of which any template template arguments are members;
|
||||||
if (ct instanceof ICPPTemplateInstance) {
|
if (ct instanceof ICPPSpecialization) {
|
||||||
for (IBinding friend : ClassTypeHelper.getFriends(ct, tu)) {
|
for (IBinding friend : ClassTypeHelper.getFriends(ct, tu)) {
|
||||||
if (friend instanceof ICPPFunction) {
|
if (friend instanceof ICPPFunction) {
|
||||||
friendFns.add((ICPPFunction) friend);
|
friendFns.add((ICPPFunction) friend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICPPTemplateArgument[] args = ((ICPPTemplateInstance) ct).getTemplateArguments();
|
if (ct instanceof ICPPTemplateInstance) {
|
||||||
for (ICPPTemplateArgument arg : args) {
|
ICPPTemplateArgument[] args = ((ICPPTemplateInstance) ct).getTemplateArguments();
|
||||||
if (arg.isTypeValue()) {
|
for (ICPPTemplateArgument arg : args) {
|
||||||
getAssociatedScopes(arg.getTypeValue(), namespaces, friendFns, handled, tu);
|
if (arg.isTypeValue()) {
|
||||||
|
getAssociatedScopes(arg.getTypeValue(), namespaces, friendFns, handled, tu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue