[LLVMbugs] [Bug 22759] New: (Brace-) Copy-Initialization of lambda-member variables of class-templates fails with “error?=:=?UTF-8?Q? excess elements in struct initializer”
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Mar 2 12:20:53 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22759
Bug ID: 22759
Summary: (Brace-) Copy-Initialization of lambda-member
variables of class-templates fails with “error: excess
elements in struct initializer”
Product: clang
Version: 3.5
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: florian.weber at sfz-bw.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Compiling the following code fails with clang 3.5:
===========================
template<typename T>
struct my_class {
my_class(T arg): t{arg} {}
T t;
};
int main() {
auto lambda = []{};
my_class<decltype(lambda)>{lambda};
}
==========================
$ uname -a
Linux terra 3.14.32-1-lts #1 SMP Fri Feb 6 20:51:49 CET 2015 x86_64 GNU/Linux
$ clang++ --version
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang++ -std=c++11 test.cpp
test.cpp:4:21: error: excess elements in struct initializer
my_class(T arg): t{arg} {}
^~~
test.cpp:10:2: note: in instantiation of member function 'my_class<(lambda at
test.cpp:9:16)>::my_class' requested here
my_class<decltype(lambda)>{lambda};
^
1 error generated.
==========================
Since lambdas do have copy-constructors I am very positive that this code
should compile and gcc agrees with me here. Otherwise the error-message would
certainly need improvement.
--
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/20150302/8aa24212/attachment.html>
More information about the llvm-bugs
mailing list