https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84158

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
I tested the modified C++ 11 example below with Clang, EDG, GCC, ICC, and MSVC.
 Of these, only MSVC implements the behavior I expect and doesn't warn.  The
others do.  (I verified that MSVC does support the attribute.)

Still, given that it's obviously meaningful to define a specialization that
does return, treating it as noreturn based on the definition of the primary is
incorrect.

Given the difference among implementations I think the standard ought to be
clarified which of the two is intended.

(See https://godbolt.org/g/sYPbD2 for Clang and MSVC output.)

template <class T>
[[noreturn]] T
g (T) { throw "not implemented"; }

template <> int
g (int) { return 0; }

int h (int i)
{
  return g (i);
}

Reply via email to