(This is a reduction from a GCC + Chromium build issue) Building the following excerpt with -std=gnu++14 causes GCC to fail, while MSVC, clang and ICC work fine: struct S { template <class U> constexpr operator U() const { return static_cast<U>(42); } }; void frob() { new char[S()]; } x.cc: In function ‘void frob()’: x.cc:9:14: error: default type conversion can't deduce template argument for ‘template<class U> constexpr S::operator U() const’ new char[S()]; ^ C++14 says in 8.3.4 Arrays that "If the constant-expression (5.20) is present, it shall be a converted constant expression of type std::size_t and its value shall be greater than zero", so I was expecting `new char[S()]' to end up invoking S::operator size_t().
This doesn't seem to ever work with G++ (even 4.8 rejects it).
Confirmed. Looks like C++14 changed it to do a conversion to size_t. Obvious workaround: new char[(size_t)S()]; The other thing I noticed is ICC accepts it for C++11 while rejects it for C++98 which is unlike clang which rejects it for both C++98 and C++11. There must have been a C++ defect report ...
Looks like n3323 was never implemented. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf Also note there is DR 1464 too.
Looks like only part of n3323 was implemented.