Repository navigation
Spurious "redeclaration of deduction guide" for guides that differ only in a type-constraint #169
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
The front end reports two deduction guides as a redeclaration when they have the same parameters and differ only in a type-constraint on a template parameter, as in
template<A T>.gcc and clang accept the code. I ran into it with a wrapper class that has one guide per concept.
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 same pair compiles when the constraint is written as a
requires-clause after the template head:It also compiles with
w(A auto) -> w<int>;as the second guide. Two guides constrained by different concepts,template<A T>andtemplate<B T>, fail like the example above. Ordinary function templates that differ only in a type-constraint compile.The check is
deduction_guides_are_redeclarations(symbol_tbl.c:7306). It compares the function type, the trailingrequires-clause and the template-headrequires-clause. It does not compare type-constraints on the template parameters, which is the one place these two guides differ.The diagnostic was added by EDGcpfe/25301 (Changes, 6/10/26, "Missing diagnostic for redeclaration of deduction guide"), so this is new in 6.9.
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