[Bug libstdc++/38265] STL treats explicit constructors as converting constructors
konto dot dydaktyczne at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 28 10:08:00 GMT 2008
------- Comment #3 from konto dot dydaktyczne at gmail dot com 2008-11-28 10:07 -------
Let me add an std::list and an std::set to my code; see below. Both additions
produce errors. So,
[sequence containers]
std::vector -> no error signaled, "explicit" ignored
std::list -> error signaled, because of "explicit"
std::deque -> no error signaled, "explicit" ignored
[associative containers]
std::set -> error signaled, because of "explicit"
#include <vector>
#include <deque>
#include <list>
#include <set>
class X {
public:
explicit X(int) {}
int operator<(const X&) const {
return 0;
}
};
int main() {
int a[1] = {};
std::vector<X> v(a, a + 1);
std::deque<X> d(a, a + 1);
std::list<X> l(a, a + 1);
std::set<X> s(a, a + 1);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38265
More information about the Gcc-bugs
mailing list