Commit 43c013d
Patrick Palka
c++: don't substitute TEMPLATE_PARM_CONSTRAINTS [PR100374]
This patch makes us avoid substituting into the TEMPLATE_PARM_CONSTRAINTS
of each template parameter except as necessary for declaration matching,
like we already do for the other constituent constraints of a declaration.
This patch also improves the CA104 implementation of explicit
specialization matching of a constrained function template inside a
class template, by considering the function's combined constraints
instead of just its trailing constraints. This allows us to correctly
handle the first three explicit specializations in concepts-spec2.C
below, but because we compare the constraints as a whole, it means we
incorrectly accept the fourth explicit specialization which writes #3's
constraints in a different way. For complete correctness here,
determine_specialization should use tsubst_each_template_parm_constraints
and template_parameter_heads_equivalent_p.
PR c++/100374
gcc/cp/ChangeLog:
* pt.cc (determine_specialization): Compare overall constraints
not just the trailing constraints.
(tsubst_each_template_parm_constraints): Define.
(tsubst_friend_function): Use it.
(tsubst_friend_class): Use it.
(tsubst_template_parm): Don't substitute TEMPLATE_PARM_CONSTRAINTS.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-spec2.C: New test.
* g++.dg/cpp2a/concepts-template-parm11.C: New test.1 parent df4f95d commit 43c013d
File tree
3 files changed
+71
-7
lines changed- gcc
- cp
- testsuite/g++.dg/cpp2a
3 files changed
+71
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
2323 | 2324 | | |
2324 | 2325 | | |
2325 | 2326 | | |
2326 | | - | |
2327 | | - | |
| 2327 | + | |
| 2328 | + | |
2328 | 2329 | | |
2329 | 2330 | | |
2330 | 2331 | | |
| |||
2333 | 2334 | | |
2334 | 2335 | | |
2335 | 2336 | | |
2336 | | - | |
| 2337 | + | |
2337 | 2338 | | |
2338 | 2339 | | |
2339 | 2340 | | |
| |||
11240 | 11241 | | |
11241 | 11242 | | |
11242 | 11243 | | |
11243 | | - | |
| 11244 | + | |
| 11245 | + | |
| 11246 | + | |
| 11247 | + | |
| 11248 | + | |
| 11249 | + | |
| 11250 | + | |
11244 | 11251 | | |
11245 | 11252 | | |
11246 | 11253 | | |
| |||
11486 | 11493 | | |
11487 | 11494 | | |
11488 | 11495 | | |
| 11496 | + | |
| 11497 | + | |
11489 | 11498 | | |
11490 | 11499 | | |
11491 | 11500 | | |
| |||
11520 | 11529 | | |
11521 | 11530 | | |
11522 | 11531 | | |
| 11532 | + | |
| 11533 | + | |
11523 | 11534 | | |
11524 | 11535 | | |
11525 | 11536 | | |
| |||
13632 | 13643 | | |
13633 | 13644 | | |
13634 | 13645 | | |
13635 | | - | |
13636 | 13646 | | |
13637 | 13647 | | |
13638 | 13648 | | |
13639 | 13649 | | |
13640 | 13650 | | |
13641 | 13651 | | |
13642 | 13652 | | |
13643 | | - | |
13644 | 13653 | | |
13645 | 13654 | | |
13646 | | - | |
| 13655 | + | |
13647 | 13656 | | |
13648 | 13657 | | |
13649 | 13658 | | |
| 13659 | + | |
| 13660 | + | |
| 13661 | + | |
| 13662 | + | |
| 13663 | + | |
| 13664 | + | |
| 13665 | + | |
| 13666 | + | |
| 13667 | + | |
| 13668 | + | |
| 13669 | + | |
| 13670 | + | |
| 13671 | + | |
| 13672 | + | |
| 13673 | + | |
| 13674 | + | |
| 13675 | + | |
| 13676 | + | |
| 13677 | + | |
13650 | 13678 | | |
13651 | 13679 | | |
13652 | 13680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments