[cfe-dev] C++11 error about initializing explicit constructor with {} ?
Benjamin Redelings
benjamin.redelings at duke.edu
Thu Jan 17 13:52:41 PST 2013
Hi,
I'm trying to compile some of my C++11 code under clang-3.2; I
originally wrote it under g++. This is a case where g++-4.8 (snapshot)
accepts my code, but clang-3.2 does not. The error message is:
In file included from ../../../master/src/mcmc/moves.C:20:
In file included from ../../../master/src/mcmc/sample.H:26:
../../../master/src/mcmc/mcmc.H:390:94: error: chosen constructor is
explicit in copy-initialization
std::set<int> get_affected_parameters(const
owned_ptr<Probability_Model>&) const {return {};}
^~
/usr/include/c++/v1/set:378:14: note: constructor declared here
explicit set(const value_compare& __comp = value_compare())
So, basically, this code is trying to initialize a std::set<int> with
{}. I'm not sure clang is right here, but I'm also not sure is wrong.
Can someone tell me, so I can possibly submit a bug report?
-BenRI
More information about the cfe-dev
mailing list