public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
@ 2021-08-04 20:23 seurer at gcc dot gnu.org
  2021-08-04 21:21 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: seurer at gcc dot gnu.org @ 2021-08-04 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101782
           Summary: [12 regression] Excess errors in
                    g++.dg/cpp2a/concepts-pr67774.C after r12-2729
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

g:240b01b0215f9e46ecf04267c8a3faeb19d4fe3c, r12-2729
make  -k check-gcc RUNTESTFLAGS="dg.exp=g++.dg/cpp2a/concepts-pr67774.C"
FAIL: g++.dg/cpp2a/concepts-pr67774.C  -std=c++2a (test for excess errors)
# of expected passes            1
# of unexpected failures        1
# of unsupported tests          3


FAIL: g++.dg/cpp2a/concepts-pr67774.C  -std=c++2a (test for excess errors)
Excess errors:
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_iterator.h:1123:5:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_iterator.h:1987:7:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_iterator.h:2010:7:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_iterator.h:2034:7:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:113:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:165:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:270:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:329:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:419:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:440:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:500:9:
error: two consecutive '[' shall only introduce an attribute before '[' token
/home3/seurer/gcc/git/build/gcc-test/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/ranges_base.h:542:9:
error: two consecutive '[' shall only introduce an attribute before '[' token



commit 240b01b0215f9e46ecf04267c8a3faeb19d4fe3c (HEAD, refs/bisect/bad)
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 3 18:06:27 2021 +0100

    libstdc++: Add [[nodiscard]] to iterators and related utilities

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

* [Bug testsuite/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
@ 2021-08-04 21:21 ` redi at gcc dot gnu.org
  2021-08-04 22:29 ` [Bug c++/101782] " redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-04 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-04
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Target Milestone|---                         |12.0

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

* [Bug c++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
  2021-08-04 21:21 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
@ 2021-08-04 22:29 ` redi at gcc dot gnu.org
  2021-08-04 22:35 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-04 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
           Assignee|redi at gcc dot gnu.org            |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW
          Component|testsuite                   |c++

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is a C++ FE bug.

This valid C++20 code:

template<typename T> concept foo = true;

template<typename T> requires foo<T>
[[nodiscard]]
int bar(T) { return 1; }

is rejected with the -fconcepts-ts flag (as both C++20 and C++17):

conc.C:4:1: error: two consecutive ‘[’ shall only introduce an attribute before
‘[’ token
    4 | [[nodiscard]]
      | ^

For C++17 mode, -fconcepts-ts defines __cpp_concepts=201507L so we could use
that to suppress the [[nodiscard]] attributes when the flag is given.

But we can't detect it for C++20 mode (which is when the testsuite errors
happen) because C++20 defines __cpp_concepts=201907L and -fconcepts-ts doesn't
change that. So I'm not sure what we can do, other than not apply the attribute
to constrained functions with a requires-clause.

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

* [Bug c++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
  2021-08-04 21:21 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
  2021-08-04 22:29 ` [Bug c++/101782] " redi at gcc dot gnu.org
@ 2021-08-04 22:35 ` redi at gcc dot gnu.org
  2021-08-05 10:31 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-04 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think we can probably do this to stop the test failing:

--- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr67774.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr67774.C
@@ -1,5 +1,4 @@
 // { dg-do compile { target c++20 } }
-// { dg-additional-options "-fconcepts-ts" }

 #include <type_traits>
 #include <utility>


Because that flag was present to enable concepts support, but concepts are
always enabled for c++20 now, and it gets run with -std=c++2a

But the FE bug still needs to be fixed.

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

* [Bug testsuite/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-04 22:35 ` redi at gcc dot gnu.org
@ 2021-08-05 10:31 ` redi at gcc dot gnu.org
  2021-08-05 11:14 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
           Keywords|rejects-valid               |
          Component|c++                         |testsuite
         Depends on|                            |68061

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The FE bug is PR 68061.

Changing component back to testsuite so this bug is only about the failing
test, not the FE bug.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68061
[Bug 68061] Can't use [[deprecated]] with requires clause

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

* [Bug testsuite/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-08-05 10:31 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
@ 2021-08-05 11:14 ` jakub at gcc dot gnu.org
  2021-08-05 14:17 ` [Bug libstdc++/101782] " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-08-05 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> This is a C++ FE bug.
> 
> This valid C++20 code:
> 
> template<typename T> concept foo = true;
> 
> template<typename T> requires foo<T>
> [[nodiscard]]
> int bar(T) { return 1; }
> 
> is rejected with the -fconcepts-ts flag (as both C++20 and C++17):
> 
> conc.C:4:1: error: two consecutive ‘[’ shall only introduce an attribute
> before ‘[’ token
>     4 | [[nodiscard]]
>       | ^
> 
> For C++17 mode, -fconcepts-ts defines __cpp_concepts=201507L so we could use
> that to suppress the [[nodiscard]] attributes when the flag is given.
> 
> But we can't detect it for C++20 mode (which is when the testsuite errors
> happen) because C++20 defines __cpp_concepts=201907L and -fconcepts-ts
> doesn't change that. So I'm not sure what we can do, other than not apply
> the attribute to constrained functions with a requires-clause.

This is because with -fconcepts-ts the requires-clause argument is parsed as
logical-or-expression rather than constraint-logical-or-expression and for the
former the [ could be part of postfix-expression in there.  Bet that is the
reason why constraint-logical-or-expression exists and allows only
primary-expressions mixed with ||s and &&s.
Perhaps the FE could have a hack, set some parser flag when parsing
requires-clause and in postfix-expression parsing if that flag is set instead
of the [[ error in there pretend [ is not there and ends the expression.

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

* [Bug libstdc++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-08-05 11:14 ` jakub at gcc dot gnu.org
@ 2021-08-05 14:17 ` cvs-commit at gcc dot gnu.org
  2021-08-05 14:28 ` redi at gcc dot gnu.org
  2021-08-05 18:01 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-05 14:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:7b1de3eb9ed3f8dde54732d88520292c5ad1157d

commit r12-2766-g7b1de3eb9ed3f8dde54732d88520292c5ad1157d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Aug 5 13:34:00 2021 +0100

    libstdc++: Move attributes that follow requires-clauses [PR101782]

    As explained in the PR, the grammar in the Concepts TS means that a [
    token following a requires-clause is parsed as part of the
    logical-or-expression rather than the start of an attribute. That makes
    the following ill-formed when using -fconcepts-ts:

      template<typename T> requires foo<T> [[nodiscard]] int f(T);

    This change moves all attributes that follow a requires-clause to the
    end of the function declarator.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/101782
            * include/bits/ranges_base.h (ranges::begin, ranges::end)
            (ranges::rbegin, ranges::rend, ranges::size, ranges::ssize)
            (ranges::empty, ranges::data): Move attribute to the end of
            the declarator.
            * include/bits/stl_iterator.h (__gnu_cxx::__normal_iterator)
            (common_iterator): Likewise for non-member operator functions.
            * include/std/ranges (views::all, views::filter)
            (views::transform, views::take, views::take_while, views::drop)
            (views::drop_while, views::join, views::lazy_split)
            (views::split, views::counted, views::common, views::reverse)
            (views::elements): Likewise.
            * testsuite/std/ranges/access/101782.cc: New test.

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

* [Bug libstdc++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-08-05 14:17 ` [Bug libstdc++/101782] " cvs-commit at gcc dot gnu.org
@ 2021-08-05 14:28 ` redi at gcc dot gnu.org
  2021-08-05 18:01 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed by changing the library headers.

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

* [Bug libstdc++/101782] [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729
  2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-08-05 14:28 ` redi at gcc dot gnu.org
@ 2021-08-05 18:01 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-05 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

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

commit r12-2773-gc8b024fa4b76bfd914e96dd3cecfbb6ee8e91316
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Aug 5 16:46:00 2021 +0100

    libstdc++: Move [[nodiscard]] attributes again [PR101782]

    Where I moved these nodiscard attributes to made them apply to the
    function type, not to the function. This meant they no longer generated
    the desired -Wunused-result warnings, and were ill-formed with Clang
    (but only a pedwarn with GCC).

    Clang also detected ill-formed attributes in <queue> which this fixes.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/101782
            * include/bits/ranges_base.h (ranges::begin, ranges::end)
            (ranges::rbegin, ranges::rend, ranges::size, ranges::ssize)
            (ranges::empty, ranges::data): Move attribute after the
            declarator-id instead of at the end of the declarator.
            * include/bits/stl_iterator.h (__gnu_cxx::__normal_iterator):
            Move attributes back to the start of the function declarator,
            but move the requires-clause to the end.
            (common_iterator): Move attribute after the declarator-id.
            * include/bits/stl_queue.h (queue): Remove ill-formed attributes
            from friend declaration that are not definitions.
            * include/std/ranges (views::all, views::filter)
            (views::transform, views::take, views::take_while,
            views::drop) (views::drop_while, views::join,
            views::lazy_split) (views::split, views::counted,
            views::common, views::reverse) (views::elements): Move
            attributes after the declarator-id.

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

end of thread, other threads:[~2021-08-05 18:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 20:23 [Bug testsuite/101782] New: [12 regression] Excess errors in g++.dg/cpp2a/concepts-pr67774.C after r12-2729 seurer at gcc dot gnu.org
2021-08-04 21:21 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
2021-08-04 22:29 ` [Bug c++/101782] " redi at gcc dot gnu.org
2021-08-04 22:35 ` redi at gcc dot gnu.org
2021-08-05 10:31 ` [Bug testsuite/101782] " redi at gcc dot gnu.org
2021-08-05 11:14 ` jakub at gcc dot gnu.org
2021-08-05 14:17 ` [Bug libstdc++/101782] " cvs-commit at gcc dot gnu.org
2021-08-05 14:28 ` redi at gcc dot gnu.org
2021-08-05 18:01 ` cvs-commit 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).