[cfe-dev] Unexpected TypeLoc match for captured variable in lambda
Eric Liu via cfe-dev
cfe-dev at lists.llvm.org
Thu Feb 14 06:13:30 PST 2019
Hi,
In the following example, the captured variable `fn` is matched as a
TypeLoc of Foo; `fn` outside of the lambda is not matched.
```
// test.cc
class Foo {};
template <typename T> struct Fn { T t; };
void f(Fn<Foo> &fn) {
[&](const Foo &foo) {
fn; // <--------- *** This is matched as a TypeLoc of Foo ***
};
}
```
clang-query> m
typeLoc(loc(qualType(hasDeclaration(namedDecl(hasName("Foo"))))))
...
Match #2:
test.cc:7:5: note: "root" binds here
fn;
^~
...
Is this a bug? If not, is there a way to filter this out?
Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190214/3f4859bf/attachment.html>
More information about the cfe-dev
mailing list