Skip to content

Commit 2162c35

Browse files
committed
Fix a bug in the property-based serialization of
dependent template names. Apparently we didn't test this in the test suite because we have a lot of redundant ways of representing this situation that kick in in the more common situations. For example, DependentTST stores a qualifier + identifier pair rather than a TemplateName.
1 parent 90719e7 commit 2162c35

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

clang/include/clang/AST/PropertiesBase.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ let Class = PropertyTypeCase<TemplateName, "DependentTemplate"> in {
362362
: nullptr) }];
363363
}
364364
def : Property<"operatorKind", OverloadedOperatorKind> {
365-
let Conditional = [{ identifier }];
365+
let Conditional = [{ !identifier }];
366366
let Read = [{ dtn->getOperator() }];
367367
}
368368
def : Creator<[{

clang/test/PCH/cxx-templates.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,13 @@ namespace DependentMemberExpr {
165165
static_assert(A<int>().f() == 1); // expected-error {{static_assert failed}}
166166
#endif
167167
}
168+
169+
namespace DependentTemplateName {
170+
struct HasMember {
171+
template <class T> struct Member;
172+
};
173+
174+
void test() {
175+
getWithIdentifier<HasMember>();
176+
}
177+
}

clang/test/PCH/cxx-templates.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,11 @@ namespace DependentMemberExpr {
448448
constexpr int f() { return Base::setstate(); }
449449
};
450450
}
451+
452+
namespace DependentTemplateName {
453+
template <template <class> class Template>
454+
struct TakesClassTemplate {};
455+
456+
template <class T>
457+
TakesClassTemplate<T::template Member> getWithIdentifier();
458+
}

0 commit comments

Comments
 (0)