mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
c++: ICE mangling C auto... tparm [PR124297]
After r16-7491, the constraint on a C auto... tparm is represented as a fold-expression (in TEMPLATE_PARM_CONSTRAINTS) instead of a concept-id (in PLACEHOLDER_TYPE_CONSTRAINTS). So we now need to strip this fold-expression before calling write_type_constraint, like we do in the type template parameter case a few lines below. PR c++/124297 gcc/cp/ChangeLog: * mangle.cc (write_template_param_decl) <case PARM_DECL>: Strip fold-expression before calling write_type_constraint. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-variadic4.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
This commit is contained in:
@@ -1927,6 +1927,11 @@ write_template_param_decl (tree parm)
|
||||
? TEMPLATE_PARM_CONSTRAINTS (parm)
|
||||
: NULL_TREE))
|
||||
{
|
||||
if (TREE_CODE (c) == UNARY_LEFT_FOLD_EXPR)
|
||||
{
|
||||
c = FOLD_EXPR_PACK (c);
|
||||
c = PACK_EXPANSION_PATTERN (c);
|
||||
}
|
||||
if (AUTO_IS_DECLTYPE (type))
|
||||
write_string ("DK");
|
||||
else
|
||||
|
||||
12
gcc/testsuite/g++.dg/cpp2a/concepts-variadic4.C
Normal file
12
gcc/testsuite/g++.dg/cpp2a/concepts-variadic4.C
Normal file
@@ -0,0 +1,12 @@
|
||||
// PR c++/124297
|
||||
// { dg-do compile { target c++20 } }
|
||||
|
||||
template<class T> concept C = true;
|
||||
|
||||
template<C auto... Vs> void f();
|
||||
|
||||
int main() {
|
||||
f<42>();
|
||||
}
|
||||
|
||||
// { dg-final { scan-assembler "_Z1fITpTnDk1CJLi42EEEvv" } }
|
||||
Reference in New Issue
Block a user