-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang][bytecode] Ignore function calls with depth > 0... #129887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
... when checking for a potential constant expression. This is also what the current interpreter does.
|
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) Changes... when checking for a potential constant expression. This is also what the current interpreter does. Full diff: https://github.com/llvm/llvm-project/pull/129887.diff 2 Files Affected:
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index a2090f3e85e08..1107c0c32792f 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -714,6 +714,9 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
return false;
}
+ if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0)
+ return false;
+
if (F->isConstexpr() && F->hasBody() &&
(F->getDecl()->isConstexpr() || F->getDecl()->hasAttr<MSConstexprAttr>()))
return true;
diff --git a/clang/test/AST/ByteCode/functions.cpp b/clang/test/AST/ByteCode/functions.cpp
index a7c8836eac6b8..a767d104b3c8a 100644
--- a/clang/test/AST/ByteCode/functions.cpp
+++ b/clang/test/AST/ByteCode/functions.cpp
@@ -681,3 +681,16 @@ namespace StableAddress {
static_assert(sum<str{"$hello $world."}>() == 1234, "");
}
#endif
+
+namespace NoDiags {
+ void huh();
+ template <unsigned>
+ constexpr void hd_fun() {
+ huh();
+ }
+
+ constexpr bool foo() {
+ hd_fun<1>();
+ return true;
+ }
+}
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/15762 Here is the relevant piece of the build log for the reference |
... when checking for a potential constant expression. This is also what the current interpreter does.