File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -4541,6 +4541,10 @@ ExpectedDecl ASTNodeImporter::VisitVarDecl(VarDecl *D) {
4541
4541
ToVar->setQualifierInfo (ToQualifierLoc);
4542
4542
ToVar->setAccess (D->getAccess ());
4543
4543
ToVar->setLexicalDeclContext (LexicalDC);
4544
+ if (D->isInlineSpecified ())
4545
+ ToVar->setInlineSpecified ();
4546
+ if (D->isInline ())
4547
+ ToVar->setImplicitlyInline ();
4544
4548
4545
4549
if (FoundByLookup) {
4546
4550
auto *Recent = const_cast <VarDecl *>(FoundByLookup->getMostRecentDecl ());
Original file line number Diff line number Diff line change @@ -5317,6 +5317,34 @@ TEST_P(ASTImporterOptionSpecificTestBase,
5317
5317
EXPECT_FALSE (ToX);
5318
5318
}
5319
5319
5320
+ TEST_P (ASTImporterOptionSpecificTestBase, VarTemplateDeclInlineWithCXX17) {
5321
+ Decl *FromTU = getTuDecl (
5322
+ R"(
5323
+ struct S {
5324
+ template <unsigned> static constexpr bool X = true;
5325
+ };
5326
+ )" ,
5327
+ Lang_CXX17, " input1.cc" );
5328
+ Decl *FromTU2 = getTuDecl (
5329
+ R"(
5330
+ struct S {
5331
+ template <unsigned> static constexpr bool X = true;
5332
+ template <typename T> void get() { X<sizeof(T)>; }
5333
+ };
5334
+ template <typename U> U qvariant_cast(const S &v) { return v.get; }
5335
+ )" ,
5336
+ Lang_CXX17, " input2.cc" );
5337
+ auto *FromX = FirstDeclMatcher<VarTemplateDecl>().match (
5338
+ FromTU, varTemplateDecl (hasName (" X" )));
5339
+ auto *ToX = Import (FromX, Lang_CXX17);
5340
+ ASSERT_TRUE (ToX);
5341
+ auto *FromX2 = FirstDeclMatcher<VarTemplateDecl>().match (
5342
+ FromTU2, varTemplateDecl (hasName (" X" )));
5343
+ auto *ToX2 = Import (FromX2, Lang_CXX17);
5344
+ ASSERT_TRUE (ToX2);
5345
+ EXPECT_EQ (ToX, ToX2);
5346
+ }
5347
+
5320
5348
TEST_P (ASTImporterOptionSpecificTestBase, VarTemplateParameterDeclContext) {
5321
5349
constexpr auto Code =
5322
5350
R"(
You can’t perform that action at this time.
0 commit comments