The following code compiles fine with gcc 4.8.1
#include <memory>
class Foo {
public:
explicit Foo(const std::shared_ptr<Foo>& foo) {
}
};
int main() {
Foo foo(nullptr);
}
Why is this possible? Shouldn't the explicit prevent the compiler from calling std::shared_ptr(nullptr) implicitly?