================
@@ -18563,6 +18556,58 @@ ExprResult Sema::ActOnCXXReflectExpr(SourceLocation
CaretCaretLoc,
ExprResult Sema::BuildCXXReflectExpr(SourceLocation CaretCaretLoc,
TypeSourceInfo *TSI) {
+ QualType QT = TSI->getType();
+ SourceLocation TypeLoc = TSI->getTypeLoc().getBeginLoc();
+
+ // Don't bother supporting VLAs here.
+ if (QT->isVariablyModifiedType()) {
+ Diag(TypeLoc, diag::err_reflect_variably_modified_type) << QT;
+ return ExprError();
+ }
+
+ // Canonicalize template arguments of alias template specializations.
+ //
+ // A parsed TST retains template arguments as written. Rebuild it with the
+ // canonical template declaration and normalized arguments so equivalent
+ // alias specializations have the same reflection identity.
+ //
+ // FIXME: This does mean that e.g. ^^A<1+2> becomes ^^A<3>; we might
+ // want to retain the original arguments somehow, but we need to make sure
+ // that doing so doesn't change the fact that ^^A<1+2> == ^^A<3>.
----------------
katzdm wrote:
If by "canonicalize", you mean "maps `1+2` to `3`" and "dealiases type template
arguments": yes. I think the only motivation to keep the original
`1+2`-argument around would be for enrichment of information remembered by the
AST, rather than for any P2996 requirement.
https://github.com/llvm/llvm-project/pull/232074
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits