File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,25 @@ namespace std {
1414 static constexpr bool value = true ;
1515 };
1616
17+ template <typename T, typename U>
18+ static constexpr bool is_same_v = is_same<T, U>::value; // NOLINT
19+
1720 template <bool , typename T = void >
1821 struct enable_if {
1922 using type = T;
2023 };
2124
25+ template <bool B, typename T = void >
26+ using enable_if_t = typename enable_if<B, T>::type; // NOLINT
27+
28+ template <typename T>
29+ struct remove_reference {
30+ using type = T;
31+ };
32+
33+ template <typename T>
34+ using remove_reference_t = typename remove_reference<T>::type; // NOLINT
35+
2236 template <typename ...>
2337 struct common_type {
2438 using type = int ;
@@ -126,3 +140,13 @@ namespace my_std = std;
126140using Alias = my_std::add_const<bool >::type;
127141// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use c++14 style type templates
128142// CHECK-FIXES: using Alias = my_std::add_const_t<bool>;
143+
144+ template <typename T>
145+ struct ImplicitlyInstantiatedConstructor {
146+ template <typename U, typename = std::enable_if_t <std::is_same_v<U, T>>>
147+ ImplicitlyInstantiatedConstructor (U) {}
148+ };
149+
150+ const ImplicitlyInstantiatedConstructor<int > ImplicitInstantiation (std::remove_reference<int >::type(123 ));
151+ // CHECK-MESSAGES: :[[@LINE-1]]:68: warning: use c++14 style type templates
152+ // CHECK-FIXES: const ImplicitlyInstantiatedConstructor<int> ImplicitInstantiation(std::remove_reference_t<int>(123));
Original file line number Diff line number Diff line change @@ -2194,6 +2194,7 @@ bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLocsHelper(
21942194 is the only callback that's made for this instantiation. \
21952195 We use getTemplateArgsAsWritten() to distinguish. */ \
21962196 if (const auto *ArgsWritten = D->getTemplateArgsAsWritten ()) { \
2197+ assert (D->getTemplateSpecializationKind () != TSK_ImplicitInstantiation); \
21972198 /* The args that remains unspecialized. */ \
21982199 TRY_TO (TraverseTemplateArgumentLocsHelper ( \
21992200 ArgsWritten->getTemplateArgs (), ArgsWritten->NumTemplateArgs )); \
You can’t perform that action at this time.
0 commit comments