http://llvm.org/bugs/show_bug.cgi?id=22461
Bug ID: 22461
Summary: Wrong AST for friend static method
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
For the following program:
struct A {
template <typename T, typename U> static void create (U) {}
};
struct B {
friend void A::create <B, const char *> (const char *);
};
int main() {
A::create<B>("test");
}
I get this AST for friend declaration:
| `-FriendDecl 0x7f801d0 <line:2:37, col:61> line:6:18
| `-CXXMethodDecl 0x7f7fc90 parent 0x7f3a0e0 prev 0x7f80000 <line:2:37,
col:61> line:6:18 used create 'void (const char *)'
| |-TemplateArgument type 'struct B'
| |-TemplateArgument type 'const char *'
| |-ParmVarDecl 0x7f7fbd0 <col:44, col:55> col:56 'const char *'
| `-CompoundStmt 0x7f7f988 <line:2:60, col:61>
As can be observed from the dump above the friend method AST is not tied to
source but it is a reference to instantiated method.
As a consequence the body is present and locations refers the templated
function and not the friend method declaration.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs