]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Check invalid use of constrained auto with trailing return type [PR100589]
authorDa Xie <xxie_xd@163.com>
Sun, 2 Mar 2025 06:45:11 +0000 (14:45 +0800)
committerPatrick Palka <ppalka@redhat.com>
Wed, 5 Mar 2025 16:11:22 +0000 (11:11 -0500)
commit7439febd94368f42bc46885224e22d2f135fedb2
tree238f5ba27d7e72c908336e7bb73b2f2254e72b26
parentff505948631713d8c62523005059b10e25343617
c++: Check invalid use of constrained auto with trailing return type [PR100589]

Add check for constrained auto type specifier in function declaration or
function type declaration with trailing return type. Issue error if such
usage is detected.

Test file renamed, and added a new test for type declaration.

Successfully bootstrapped and regretested on x86_64-pc-linux-gnu:
Added 6 passed and 4 unsupported tests.

PR c++/100589

gcc/cp/ChangeLog:

* decl.cc (grokdeclarator): Issue an error for a declarator with
constrained auto type specifier and trailing return types. Include
function names if available.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-pr100589.C: New test.

Signed-off-by: Da Xie <xxie_xd@163.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/decl.cc
gcc/testsuite/g++.dg/cpp2a/concepts-pr100589.C [new file with mode: 0644]