Skip to content

Commit 81413f0

Browse files
committed
restore code that was actually useful
1 parent 38c43e1 commit 81413f0

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

clang/lib/Sema/SemaConcept.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,13 @@ void SubstituteParameterMappings::buildParameterMapping(
19371937
static_cast<FoldExpandedConstraint &>(N).getPattern(),
19381938
/*OnlyDeduced=*/false,
19391939
/*Depth=*/0, OccurringIndices);
1940+
} else if (N.getKind() == NormalizedConstraint::ConstraintKind::ConceptId) {
1941+
auto *Args = static_cast<ConceptIdConstraint &>(N)
1942+
.getConceptId()
1943+
->getTemplateArgsAsWritten();
1944+
if (Args)
1945+
SemaRef.MarkUsedTemplateParameters(Args->arguments(),
1946+
/*Depth=*/0, OccurringIndices);
19401947
}
19411948
TemplateArgumentLoc *TempArgs =
19421949
new (SemaRef.Context) TemplateArgumentLoc[OccurringIndices.count()];

clang/test/SemaTemplate/concepts.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,4 +1311,26 @@ static_assert(!E<int>);
13111311

13121312
}
13131313

1314+
1315+
namespace case3 {
1316+
template <class> constexpr bool is_move_constructible_v = false;
1317+
1318+
template <class _Tp>
1319+
concept __cpp17_move_constructible = is_move_constructible_v<_Tp>; // #is_move_constructible_v
1320+
1321+
template <class _Tp>
1322+
concept __cpp17_copy_constructible = __cpp17_move_constructible<_Tp>; // #__cpp17_move_constructible
1323+
1324+
template <class _Iter>
1325+
concept __cpp17_iterator = __cpp17_copy_constructible<_Iter>; // #__cpp17_copy_constructible
1326+
1327+
struct not_move_constructible {};
1328+
static_assert(__cpp17_iterator<not_move_constructible>); \
1329+
// expected-error {{static assertion failed}} \
1330+
// expected-note {{because 'not_move_constructible' does not satisfy '__cpp17_iterator'}} \
1331+
// expected-note@#__cpp17_copy_constructible {{because 'not_move_constructible' does not satisfy '__cpp17_copy_constructible'}} \
1332+
// expected-note@#__cpp17_move_constructible {{because 'parameter_mapping_regressions::case3::not_move_constructible' does not satisfy '__cpp17_move_constructible'}} \
1333+
// expected-note@#is_move_constructible_v {{because 'is_move_constructible_v<parameter_mapping_regressions::case3::not_move_constructible>' evaluated to false}}
1334+
}
1335+
13141336
}

clang/test/SemaTemplate/instantiate-template-argument.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static_assert(foo<char, 'a'>() == 2);
4949
// expected-error@-1{{no matching function for call to 'foo'}}
5050
// expected-note@#case1_foo1{{candidate template ignored: constraints not satisfied [with T = char, W = 'a']}}
5151
// expected-note@#case1_foo1{{because 'C2<char, 'a'>' evaluated to false}}
52-
// expected-note@#case1_C2{{because 'C1<Y{}, V>' evaluated to false}}
52+
// expected-note@#case1_C2{{because 'C1<char{}, 'a'>' evaluated to false}}
5353
// expected-note@#case1_C1{{because 'sizeof ('\x00') >= 4' (1 >= 4) evaluated to false}}
5454
// expected-note@#case1_foo2{{candidate template ignored: constraints not satisfied [with T = char, X = 'a']}}
5555
// expected-note@#case1_foo2{{because 'C1<char{}, 'a'>' evaluated to false}}

0 commit comments

Comments
 (0)