]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Move attributes that follow requires-clauses [PR101782]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 5 Aug 2021 12:34:00 +0000 (13:34 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 5 Aug 2021 14:16:58 +0000 (15:16 +0100)
commit7b1de3eb9ed3f8dde54732d88520292c5ad1157d
tree50945c8bc786a899aeae7355e645b3d2cda1a32f
parent72264a639729a5dcc21dbee304717ce22b338bfd
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.
libstdc++-v3/include/bits/ranges_base.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/access/101782.cc [new file with mode: 0644]