Repository navigation
CWG 2707 and CWG 2913: trailing requires-clause on a deduction guide
#184
stevensudit-corvid
started this conversation in
Issue Triage - Compilation
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue Summary
Core issues 2707 and 2913 allow a
requires-clause at the end of a deduction guide, after thesimple-template-id. The front end does not parse that clause yet and reports a missing semicolon. Both issues are recent defect reports, so I am reporting this as something not implemented yet.gcc and clang accept the code. The workaround for cpfe is to write the same constraint in the template head.
Reproducing Source Code
Command-line Options
cpfe --c++23 repro.cpp
Type of Issue
[Front End] This code SHOULD compile with these options.
Additional Details
The diagnostic, at 158320e (version 7.0):
--c++20and--c++26give the same error, and so do the GNU, Clang and Microsoft modes.The grammar changed twice. Core issue 2707, accepted as a defect report in March 2024, added the optional
requires-clause before the arrow. Core issue 2913, accepted as a defect report in November 2024, moved it after thesimple-template-id, to match function declarations. The current working draft has:The template-head spelling of the same guide compiles:
In the source, a guide's declarator is scanned by a direct call to
function_declarator: templates.c:20809 inscan_template_declarationfor a guide template, and decls.c:21759 inscan_deduction_guidefor a non-template guide. The trailingrequires-clause of a function is scanned at the end ofdeclarator(declarator.c:9147), which the guide path does not go through, so therequireskeyword is left for the caller's semicolon check.deduction_guides_are_redeclarations(symbol_tbl.c:7306) already compares the trailingrequires-clauses of two guides.Reproducing (Standard) Configuration(s)
linux-gcc-release
Reproducing (Non-standard) Configuration
No response
I acknowledge that:
LICENSE.txtfile in my.zipor.tar.gzupload. If I included aLICENSE.txtfile, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.All reactions