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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-09-01
           Keywords|                            |diagnostic
         Resolution|INVALID                     |---
            Summary|std::barrier missing        |poor diagnostic for missing
                   |default template argument?  |template argument list on
                   |                            |function parameter
             Status|RESOLVED                    |NEW
     Ever confirmed|0                           |1

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reopening as a diagnostic bug.

With an unnamed parameter like so:

template<class T = void> struct barrier { };

void func(barrier&) { }

G++ says:

param.C:3:11: error: class template placeholder ‘barrier’ not permitted in this
context
    3 | void func(barrier&) { }
      |           ^~~~~~~

With a named parameter like so:

template<class T = void> struct barrier { };

void func(barrier& b) { }


G++ says:

param.C:3:11: error: template placeholder type ‘barrier<...auto...>’ must be
followed by a simple declarator-id
    3 | void func(barrier& b) { }
      |           ^~~~~~~
param.C:1:33: note: ‘template<class T> struct barrier’ declared here
    1 | template<class T = void> struct barrier { };
      |                                 ^~~~~~~

Neither of these are really useful. This is not a template placeholder type,
it's just an invalid attempt to refer to barrier<>&.

If we hit this error, could we look up 'barrier' and see what it is? If it's a
concept, give the template placeholder type error, and if it's a class template
suggest that the template argument list is missing. For bonus points, if the
class template can be instantiated with an empty template argument list, add a
fix-it suggesting '<>'

Reply via email to