https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89287
Bug ID: 89287 Summary: Array declaration fails to use template conversion operator Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: raphael.kubo.da.costa at intel dot com Target Milestone: --- (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().