http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56976
Bug #: 56976 Summary: using braces to initialize a reference forces copy construction Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: akim.demai...@gmail.com Hi all, I hope this is not yet another buggy bug report. I have browsed the draft (I don't have the current standard), and saw nothing clear cut, yet the principle of least surprise tends to think this is really a bug. Below, using braces to initialize a const-ref forces a call to a copy-constructor. clang compiles this without error/warning. Cheers! $ cat bar.cc struct bar { bar() = default; bar(const bar&) = delete; }; int main() { bar b; const bar& b1_(b); const bar& b2_{b}; } $ g++-mp-4.8 -std=c++11 -Wall -Wno-unused-variable bar.cc bar.cc: In function 'int main()': bar.cc:11:19: error: use of deleted function 'bar::bar(const bar&)' const bar& b2_{b}; ^ bar.cc:4:3: error: declared here bar(const bar&) = delete; ^ $ clang++-mp-3.2 -std=c++11 -Wall bar.cc -Wno-unused-variable $