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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nshead at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
This was caused by GCC 14's incomplete implementation of P1815
(translation-unit local entities).  GCC 15 has much more complete support with
only a couple of bugs left; this snippet is now compiled correctly.

Note though, with '-Wall -Wextra':

<source>:10:15: warning: 'template<class T> static void
scalar_traits<T>::type_bar(const T&)' refers to TU-local entity 'void
{anonymous}::bar()' and cannot be instantiated in other TUs
[-Wtemplate-names-tu-local]
   10 |   static void type_bar (const T& t) {
      |               ^~~~~~~~
<source>:5:8: note: 'void {anonymous}::bar()' declared with internal linkage
    5 |   void bar(){}
      |        ^~~

This is the correct behaviour according to the standard.

Reply via email to