[llvm-bugs] [Bug 35952] New: CXXNewExpr returns invalid end loc for valid code "new struct Foo; "

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 15 09:10:56 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=35952

            Bug ID: 35952
           Summary: CXXNewExpr returns invalid end loc for valid code "new
                    struct Foo;"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hokein at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Reproduce code:

```
void NewExprCheck::registerMatchers(MatchFinder *Finder) {
  Finder->addMatcher(cxxNewExpr().bind("x"), this);
}

void NewExprCheck::check(const MatchFinder::MatchResult &Result) {
  const auto *E = Result.Nodes.getNodeAs<CXXNewExpr>("x");
  E->getEndLoc().dump(Result.Context->getSourceManager());
}
```


For the following test code:

```
struct Foo {}

void f() {
  new struct Foo; // invalid end loc
  new Foo; // valid end loc
}
```

-- 
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/20180115/dbfb9ee7/attachment.html>


More information about the llvm-bugs mailing list