<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Wrong AST for friend static method"
href="http://llvm.org/bugs/show_bug.cgi?id=22461">22461</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong AST for friend static method
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>abramo.bagnara@bugseng.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>