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

Jonathan Wakely jwakely@redhat.com
Fri Aug 6 13:29:37 GMT 2021

On 05/08/21 19:02 +0100, Jonathan Wakely wrote:
>On 05/08/21 15:40 +0100, Jonathan Wakely wrote:
>>On 05/08/21 15:19 +0100, Jonathan Wakely wrote:
>>>On 04/08/21 12:55 +0100, Jonathan Wakely wrote:
>>>>This adds [[nodiscard]] throughout <iterator>, as proposed by P2377R0
>>>>(with some minor corrections).
>>>>The attribute is added for all modes from C++11 up, using
>>>>[[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't
>>>>be used directly.
>>>This change causes errors when -fconcepts-ts is used. Fixed like so.
>>>Tested powerpc64le-linux, committed to trunk.
>>>commit 7b1de3eb9ed3f8dde54732d88520292c5ad1157d
>>>Author: Jonathan Wakely <jwakely@redhat.com>
>>>Date:   Thu Aug 5 13:34:00 2021
>>>  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.
>>Except that as Jakub pointed out, putting it there doesn't work.
>>It needs to be:
>> template<typename T> requires foo<T> int f [[nodiscard]] (T);
>>At least the testsuite isn't failing now, but the attributes I moved
>>have no effect. I'll fix it ... some time.
>This should be correct now.

Except I needed to move the ones I added to <compare> as well.

Tested powerpc64le-linux, pushed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3707 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210806/6a0de444/attachment.bin>

More information about the Gcc-patches mailing list