[llvm-bugs] [Bug 44005] New: lambda expression in template argument fails
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 14 15:07:13 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44005
Bug ID: 44005
Summary: lambda expression in template argument fails
Product: clang
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: stsp2 at yandex.ru
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
The below example is accepted with g++ -std=c++2a:
---
template <auto O>
struct B {
static constexpr int off = O();
};
struct A {
char a;
B<[](){ return 0; }> b;
};
---
But with clang there is an error:
---
$ clang++ -std=c++2a -o offs1 offs1.cpp
offs1.cpp:11:7: error: a lambda expression cannot appear in this context
B<[](){ return 0; }> b;
^
offs1.cpp:11:7: error: a non-type template parameter cannot have type
'A::(lambda at offs1.cpp:11:7)'
offs1.cpp:4:16: note: template parameter is declared here
template <auto O>
^
2 errors generated.
---
--
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/20191114/3171e67d/attachment.html>
More information about the llvm-bugs
mailing list