[LLVMbugs] [Bug 22461] New: Wrong AST for friend static method

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 4 10:39:09 PST 2015


            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: unassignedclangbugs at nondot.org
          Reporter: abramo.bagnara at bugseng.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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() {

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150204/57fc28d2/attachment.html>

More information about the llvm-bugs mailing list