Skip to content

Commit 2194a6a

Browse files
Add test for VisitPseudoObjectExpr
1 parent bfa402e commit 2194a6a

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

clang/unittests/AST/ASTImporterTest.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3316,7 +3316,6 @@ TEST_P(ImportExpr, ImportSubstNonTypeTemplateParmPackExpr) {
33163316
typedefNameDecl(hasName("declToImport")));
33173317
}
33183318

3319-
33203319
TEST_P(ImportExpr, ImportCXXParenListInitExpr) {
33213320
MatchVerifier<Decl> Verifier;
33223321
const char *Code = R"(
@@ -3333,6 +3332,43 @@ TEST_P(ImportExpr, ImportCXXParenListInitExpr) {
33333332
typedefNameDecl(hasName("declToImport")));
33343333
}
33353334

3335+
TEST_P(ImportExpr, ImportPseudoObjectExpr) {
3336+
MatchVerifier<Decl> Verifier;
3337+
const char *Code = R"(
3338+
namespace std {
3339+
struct strong_ordering {
3340+
int n;
3341+
constexpr operator int() const { return n; }
3342+
static const strong_ordering less, equal, greater;
3343+
};
3344+
constexpr strong_ordering strong_ordering::less{-1},
3345+
strong_ordering::equal{0}, strong_ordering::greater{1};
3346+
}
3347+
3348+
struct A {
3349+
std::strong_ordering operator<=>(const A&) const;
3350+
};
3351+
struct B {
3352+
bool operator==(const B&) const;
3353+
bool operator<(const B&) const;
3354+
};
3355+
3356+
template<typename T> struct Cmp : T {
3357+
std::strong_ordering operator<=>(const Cmp&) const = default;
3358+
};
3359+
3360+
void use(...);
3361+
void declToImport() {
3362+
use(
3363+
Cmp<A>() <=> Cmp<A>(),
3364+
Cmp<B>() <=> Cmp<B>()
3365+
);
3366+
}
3367+
)";
3368+
testImport(Code, Lang_CXX20, "", Lang_CXX20, Verifier,
3369+
functionDecl(hasName("declToImport")));
3370+
}
3371+
33363372
class ImportImplicitMethods : public ASTImporterOptionSpecificTestBase {
33373373
public:
33383374
static constexpr auto DefaultCode = R"(

0 commit comments

Comments
 (0)