aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 4c7ea5e..3cab4c6 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -3300,6 +3300,72 @@ TEST_P(ImportExpr, ConceptNestedNonInstantiationDependentRequirement) {
conceptDecl(has(requiresExpr(has(requiresExprBodyDecl())))));
}
+TEST_P(ImportExpr, ImportSubstNonTypeTemplateParmPackExpr) {
+ MatchVerifier<Decl> Verifier;
+ const char *Code = R"(
+ template<auto ...> struct X {};
+ template<typename ...> struct Z {};
+
+ template<int ...N> struct E {
+ template<int ...M> using B = Z<X<N, M>...>;
+ template<int M1, int M2> E(B<M1, M2>);
+ };
+ using declToImport = E<1, 3>;
+ )";
+ testImport(Code, Lang_CXX20, "", Lang_CXX20, Verifier,
+ typedefNameDecl(hasName("declToImport")));
+}
+
+TEST_P(ImportExpr, ImportCXXParenListInitExpr) {
+ MatchVerifier<Decl> Verifier;
+ const char *Code = R"(
+ struct Node {
+ int val;
+ double d;
+ };
+ Node* declToImport() { return new Node(2, 3.14); }
+ )";
+ testImport(Code, Lang_CXX20, "", Lang_CXX20, Verifier,
+ functionDecl(hasName("declToImport")));
+}
+
+TEST_P(ImportExpr, ImportPseudoObjectExpr) {
+ MatchVerifier<Decl> Verifier;
+ const char *Code = R"(
+ namespace std {
+ struct strong_ordering {
+ int n;
+ constexpr operator int() const { return n; }
+ static const strong_ordering less, equal, greater;
+ };
+ constexpr strong_ordering strong_ordering::less{-1},
+ strong_ordering::equal{0}, strong_ordering::greater{1};
+ }
+
+ struct A {
+ std::strong_ordering operator<=>(const A&) const;
+ };
+ struct B {
+ bool operator==(const B&) const;
+ bool operator<(const B&) const;
+ };
+
+ template<typename T> struct Cmp : T {
+ std::strong_ordering operator<=>(const Cmp&) const = default;
+ };
+
+ void use(...);
+ void declToImport() {
+ use(
+ Cmp<A>() <=> Cmp<A>(),
+ Cmp<B>() <=> Cmp<B>()
+ );
+ }
+ )";
+ testImport(Code, Lang_CXX20, "", Lang_CXX20, Verifier,
+ functionDecl(hasName("declToImport")));
+}
+
class ImportImplicitMethods : public ASTImporterOptionSpecificTestBase {
public:
static constexpr auto DefaultCode = R"(