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

            Bug ID: 106793
           Summary: std::barrier missing default template argument?
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gonzalo.gadeschi at gmail dot com
  Target Milestone: ---

The following example fails:

    #include <barrier>
    void test(std::barrier& b) { b.arrive_and_wait(); }

with the following error when compiled using g++ -std=c++20 and trunk:

<source>:3:11: error: template placeholder type 'barrier<...auto...>' must be
followed by a simple declarator-id
    3 | void test(std::barrier& b) {
      |           ^~~
In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20220825/include/c++/13.0.0/barrier:204:11:
note: 'template<class _CompletionF> class std::barrier' declared here
  204 |     class barrier
      |           ^~~~~~~
<source>: In function 'void test(...)'

godbolt: https://gcc.godbolt.org/z/7fE1PGq6o

My reading of the standard, here, http://eel.is/c++draft/thread.barrier#class-6
is that the standard requires barrier to have a default template argument, and
therefore, the above should work.

Is this a bug or am I misunderstanding this?

Reply via email to