[llvm-bugs] [Bug 35195] New: clang considers explicitly captured template member variables to be dependent
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 3 10:50:51 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=35195
Bug ID: 35195
Summary: clang considers explicitly captured template member
variables to be dependent
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: marc at groundctl.com
CC: llvm-bugs at lists.llvm.org
Code is as follows:
struct foo {
template <int> void foo_fun();
};
template <int> struct bar {
foo* f;
void bar_fun() {
f->foo_fun<3>(); //Works
f->template foo_fun<3>(); // Works
[this]{
f->foo_fun<3>(); //Works
f->template foo_fun<3>(); // Works
};
[f=f]{
f->foo_fun<3>(); //Doesn't work
f->template foo_fun<3>(); // Works
};
}
};
In the last lambda, f is considered a dependent name, so f->foo_fun is
considered a value, not a template function, so f->foo_fun<3>() is parsed as
((f->foo_fun) < 3) > (), which fails since () isn't an expression. I believe f
isn't a dependent name since it doesn't depend on bar's (unnamed) template
parameter, it isn't considered dependent in bar itself (even when accessed in a
lambda via a captured this pointer), and this code is accepted by gcc, icc, and
msvc.
--
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/20171103/ae22ab27/attachment.html>
More information about the llvm-bugs
mailing list