https://bugs.llvm.org/show_bug.cgi?id=34005
Bug ID: 34005
Summary: Compiler confused when compiling template variable
initialized by lambda-expression with default
parameter.
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: shirayama.kazats...@gmail.com
CC: llvm-bugs@lists.llvm.org
The code below fail to be compile.
// prog.cc
template<int> struct X {};
template<int n> constexpr void f(X<n>) {}
template<typename> constexpr int v = [](int r = 0l) constexpr { return r; }();
int main() {
f<v<int>>(X<0>());
}
$ clang++ -std=c++1z prog.cc
prog.cc:6:5: error: no matching function for call to 'f'
f<v<int>>(X<0>());
^~~~~~~~~
prog.cc:2:32: note: candidate function not viable: no known conversion from
'X<...>' to 'X<...>' for 1st argument
template<int n> constexpr void f(X<n>) {}
^
1 error generated.
I think v<T> is always 0, so f<v<int>>(X<0>()) should match f<0>(X<0>);
And if lambda's default parameter type is int,
template<typename> constexpr int v = [](int r = 0) constexpr { return r; }();
There are no errors.
This link is the result executed by wandbox.
https://wandbox.org/permlink/yjKqrYKQyl2YZ6PO
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs