https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63757
Bug ID: 63757
Summary: nullptr conversion sequence fails to compile
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: R.HL at gmx dot net
This code
#include <cstddef>
void bar(void*) {}
struct foo
{
operator std::nullptr_t()
{
return nullptr;
}
};
int main()
{
bar(foo());
}
Does not compile with GCC 4.9.1 (neither -std=c++11 nor =c++14). However, it
should; There is one user defined conversion sequence inherent, consisting of
one standard conversion sequence converting nullptr to nullptr_t (which is a
pointer conversion, specifically a null pointer conversion), one user defined
conversion through the conversion operator function and a second standard
conversion sequence converting nullptr_t to void* (Which is also a pointer
conversion).