public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106793] New: std::barrier missing default template argument?
@ 2022-08-31 15:35 gonzalo.gadeschi at gmail dot com
  2022-09-01  6:02 ` [Bug libstdc++/106793] " hewillk at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gonzalo.gadeschi at gmail dot com @ 2022-08-31 15:35 UTC (permalink / raw)
  To: gcc-bugs

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/106793] std::barrier missing default template argument?
  2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
@ 2022-09-01  6:02 ` hewillk at gmail dot com
  2022-09-01  6:42 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2022-09-01  6:02 UTC (permalink / raw)
  To: gcc-bugs

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

康桓瑋 <hewillk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hewillk at gmail dot com

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
C++ does not allow omitting <> for function parameters like:

template<class = void>
struct S { };

void test(S& s);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/106793] std::barrier missing default template argument?
  2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
  2022-09-01  6:02 ` [Bug libstdc++/106793] " hewillk at gmail dot com
@ 2022-09-01  6:42 ` redi at gcc dot gnu.org
  2022-09-01 14:07 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-01  6:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Indeed, you need to use barrier<>

You can clearly see the default template argument is present:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/std/barrier;h=2a2650546add5cce7b2af2c294672eaa3c03fc7e;hb=HEAD#l203

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/106793] std::barrier missing default template argument?
  2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
  2022-09-01  6:02 ` [Bug libstdc++/106793] " hewillk at gmail dot com
  2022-09-01  6:42 ` redi at gcc dot gnu.org
@ 2022-09-01 14:07 ` redi at gcc dot gnu.org
  2022-09-07 15:27 ` [Bug c++/106793] poor diagnostic for missing template argument list on function parameter jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-01 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC's error is not helpful, but clang clearly explains what's wrong:

error: use of class template 'barrier' requires template arguments; argument
deduction not allowed in function prototype

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106793] poor diagnostic for missing template argument list on function parameter
  2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
                   ` (2 preceding siblings ...)
  2022-09-01 14:07 ` redi at gcc dot gnu.org
@ 2022-09-07 15:27 ` jason at gcc dot gnu.org
  2022-09-07 17:37 ` cvs-commit at gcc dot gnu.org
  2022-09-07 17:38 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-09-07 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106793] poor diagnostic for missing template argument list on function parameter
  2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
                   ` (3 preceding siblings ...)
  2022-09-07 15:27 ` [Bug c++/106793] poor diagnostic for missing template argument list on function parameter jason at gcc dot gnu.org
@ 2022-09-07 17:37 ` cvs-commit at gcc dot gnu.org
  2022-09-07 17:38 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-07 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:b9cb441c98f265bff86a1c228932524c5fd37dd3

commit r13-2527-gb9cb441c98f265bff86a1c228932524c5fd37dd3
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Sep 2 08:45:02 2022 -0400

    c++: diagnostic for template placeholder in parm [PR106793]

    Talking about the declarator form doesn't help when fixing that would get
    you a different error about placeholders not being valid in a parameter.

    This also adds a <> fixit, which isn't enough for most templates, but is a
    start.

            PR c++/106793

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Improve placeholder diagnostics.
            * parser.cc (cp_parser_type_id_1): Add fixit.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/auto-array2.C: Adjust.
            * g++.dg/cpp1z/class-deduction113.C: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106793] poor diagnostic for missing template argument list on function parameter
  2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
                   ` (4 preceding siblings ...)
  2022-09-07 17:37 ` cvs-commit at gcc dot gnu.org
@ 2022-09-07 17:38 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-09-07 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |13.0
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-07 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 15:35 [Bug libstdc++/106793] New: std::barrier missing default template argument? gonzalo.gadeschi at gmail dot com
2022-09-01  6:02 ` [Bug libstdc++/106793] " hewillk at gmail dot com
2022-09-01  6:42 ` redi at gcc dot gnu.org
2022-09-01 14:07 ` redi at gcc dot gnu.org
2022-09-07 15:27 ` [Bug c++/106793] poor diagnostic for missing template argument list on function parameter jason at gcc dot gnu.org
2022-09-07 17:37 ` cvs-commit at gcc dot gnu.org
2022-09-07 17:38 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).