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
|
@ -8692,6 +8692,27 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
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>
|
||||
// constexpr T t(T) {
|
||||
// return 0;
|
||||
|
|
|
@ -805,12 +805,13 @@ public class CPPSemantics {
|
|||
// * ... types of the template arguments for template type parameters
|
||||
// (excluding template template parameters);
|
||||
// * ... owners of which any template template arguments are members;
|
||||
if (ct instanceof ICPPTemplateInstance) {
|
||||
if (ct instanceof ICPPSpecialization) {
|
||||
for (IBinding friend : ClassTypeHelper.getFriends(ct, tu)) {
|
||||
if (friend instanceof ICPPFunction) {
|
||||
friendFns.add((ICPPFunction) friend);
|
||||
}
|
||||
}
|
||||
if (ct instanceof ICPPTemplateInstance) {
|
||||
ICPPTemplateArgument[] args = ((ICPPTemplateInstance) ct).getTemplateArguments();
|
||||
for (ICPPTemplateArgument arg : args) {
|
||||
if (arg.isTypeValue()) {
|
||||
|
@ -818,6 +819,7 @@ public class CPPSemantics {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (t instanceof IFunctionType) {
|
||||
IFunctionType ft = (IFunctionType) t;
|
||||
getAssociatedScopes(ft.getReturnType(), namespaces, friendFns, handled, tu);
|
||||
|
|
Loading…
Add table
Reference in a new issue