Entity proxies are ill-formed in P2996.
This commit is contained in:
@@ -3136,6 +3136,8 @@ def err_reflect_overload_set : Error<
|
||||
"cannot take the reflection of an overload set">;
|
||||
def err_reflect_nttp : Error<
|
||||
"cannot take the reflection of a non-type template parameter">;
|
||||
def err_reflect_using_declarator : Error<
|
||||
"cannot take the reflection of a using-declarator">;
|
||||
def err_reflect_init_capture : Error<
|
||||
"cannot take the reflection of a local entity declared by init-capture">;
|
||||
def err_reflect_local_requires_param : Error<
|
||||
|
||||
@@ -7196,7 +7196,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
CmdArgs.push_back("-freflection");
|
||||
CmdArgs.push_back("-fparameter-reflection");
|
||||
CmdArgs.push_back("-fannotation-attributes");
|
||||
CmdArgs.push_back("-fentity-proxy-reflection");
|
||||
CmdArgs.push_back("-fexpansion-statements");
|
||||
}
|
||||
|
||||
|
||||
@@ -893,9 +893,10 @@ ExprResult Sema::ActOnCXXReflectExpr(SourceLocation OpLoc,
|
||||
if (auto *USD = dyn_cast<UsingShadowDecl>(ND)) {
|
||||
if (getLangOpts().EntityProxyReflection)
|
||||
return BuildCXXReflectExpr(OpLoc, NameInfo.getBeginLoc(), USD);
|
||||
else do
|
||||
ND = cast<UsingShadowDecl>(ND)->getTargetDecl();
|
||||
while (isa<UsingShadowDecl>(ND));
|
||||
else {
|
||||
Diag(SS.getBeginLoc(), diag::err_reflect_using_declarator);
|
||||
return ExprError();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto *TD = dyn_cast<TypeDecl>(ND)) {
|
||||
@@ -1134,8 +1135,10 @@ ExprResult Sema::BuildCXXReflectExpr(SourceLocation OperatorLoc,
|
||||
if (auto *UT = dyn_cast<UsingType>(T)) {
|
||||
if (Context.getLangOpts().EntityProxyReflection)
|
||||
return BuildCXXReflectExpr(OperatorLoc, OperandLoc, UT->getFoundDecl());
|
||||
else
|
||||
T = UT->getUnderlyingType();
|
||||
else {
|
||||
Diag(OperandLoc, diag::err_reflect_using_declarator);
|
||||
return ExprError();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto *STTPTy = T->getAs<SubstTemplateTypeParmType>())
|
||||
@@ -1163,12 +1166,15 @@ ExprResult Sema::BuildCXXReflectExpr(SourceLocation OperatorLoc,
|
||||
ReflectionKind RK = ReflectionKind::Declaration;
|
||||
if (isa<TranslationUnitDecl, NamespaceDecl, NamespaceAliasDecl>(D))
|
||||
RK = ReflectionKind::Namespace;
|
||||
else if (isa<UsingShadowDecl>(D))
|
||||
else if (isa<UsingShadowDecl>(D)) {
|
||||
if (!getLangOpts().EntityProxyReflection) {
|
||||
Diag(OperandLoc, diag::err_reflect_using_declarator);
|
||||
return ExprError();
|
||||
}
|
||||
RK = ReflectionKind::EntityProxy;
|
||||
}
|
||||
|
||||
APValue RV(RK, D);
|
||||
if (!getLangOpts().EntityProxyReflection)
|
||||
RV = MaybeUnproxy(Context, RV);
|
||||
return CXXReflectExpr::Create(Context, OperatorLoc,
|
||||
SourceRange(OperandLoc, OperandLoc), RV);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// RUN: %clang_cc1 %s -std=c++23 -freflection
|
||||
// RUN: %clang_cc1 %s -std=c++23 -freflection -fentity-proxy-reflection
|
||||
|
||||
using info = decltype(^^int);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user