Handle decl-type TemplateArguments in define_aggregate.

Fixes #145.
This commit is contained in:
Dan Katz
2025-05-30 08:56:09 -04:00
parent 5a8802ca2f
commit 9b5188a261
2 changed files with 29 additions and 0 deletions

View File

@@ -543,6 +543,12 @@ public:
ParsedTArgs.emplace_back(SS, P, SourceLocation());
break;
}
case TemplateArgument::Declaration: {
Expr *E = CreateRefToDecl(S, TArg.getAsDecl(), SourceLocation());
ParsedTArgs.emplace_back(ParsedTemplateArgument::NonType, E,
SourceLocation());
break;
}
// TODO(P2996): Handle other kinds of TemplateArgument
// (e.g., structural).
default:

View File

@@ -373,4 +373,27 @@ consteval { (void) fn2(fn1()); }
} // namespace out_of_scope_injections
// ========================================
// bb_clang_p2996_issue_145_regression_test
// ========================================
namespace bb_clang_p2996_issue_145_regression_test {
template<int>
struct int_template;
struct int_holder { int x; };
template<int_holder>
struct int_holder_template;
consteval {
std::meta::define_aggregate(^^int_template<0>, {});
std::meta::define_aggregate(^^int_holder_template<int_holder{0}>, {});
}
int_template<0> o1;
int_holder_template<int_holder{0}> o2;
} // namespace bb_clang_p2996_issue_145_regression_test
int main() { }