[clang] [clang][Interp] Only emit function_param_value_unknown in C++11 (PR #67990)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 07:31:42 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
<details>
<summary>Changes</summary>
This is also what the current interpreter does.
No test for now since the only reproducer I have is from https://reviews.llvm.org/D156565 and doesn't work without that patch.
---
Full diff: https://github.com/llvm/llvm-project/pull/67990.diff
1 Files Affected:
- (modified) clang/lib/AST/Interp/Interp.cpp (+6-2)
``````````diff
diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp
index e1951574edb6288..9772f612b409ea3 100644
--- a/clang/lib/AST/Interp/Interp.cpp
+++ b/clang/lib/AST/Interp/Interp.cpp
@@ -549,8 +549,12 @@ bool CheckDeclRef(InterpState &S, CodePtr OpPC, const DeclRefExpr *DR) {
const SourceInfo &E = S.Current->getSource(OpPC);
if (isa<ParmVarDecl>(D)) {
- S.FFDiag(E, diag::note_constexpr_function_param_value_unknown) << D;
- S.Note(D->getLocation(), diag::note_declared_at) << D->getSourceRange();
+ if (S.getLangOpts().CPlusPlus11) {
+ S.FFDiag(E, diag::note_constexpr_function_param_value_unknown) << D;
+ S.Note(D->getLocation(), diag::note_declared_at) << D->getSourceRange();
+ } else {
+ S.FFDiag(E);
+ }
} else if (const auto *VD = dyn_cast<VarDecl>(D)) {
if (!VD->getType().isConstQualified()) {
S.FFDiag(E,
``````````
</details>
https://github.com/llvm/llvm-project/pull/67990
More information about the cfe-commits
mailing list