Author: Timm Baeder Date: 2026-01-10T15:40:48+01:00 New Revision: bf017614ae101e66a59aadb24490fcd2d3aa88e0
URL: https://github.com/llvm/llvm-project/commit/bf017614ae101e66a59aadb24490fcd2d3aa88e0 DIFF: https://github.com/llvm/llvm-project/commit/bf017614ae101e66a59aadb24490fcd2d3aa88e0.diff LOG: [clang][bytecode] Limit "... variable whose value is not known" diags (#175287) To variables with reference types. Added: Modified: clang/lib/AST/ByteCode/Interp.cpp clang/test/SemaTemplate/deduction.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index 0a083a4990856..7e901aa65af1c 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -137,7 +137,7 @@ static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC, static bool diagnoseUnknownDecl(InterpState &S, CodePtr OpPC, const ValueDecl *D) { // This function tries pretty hard to produce a good diagnostic. Just skip - // tha if nobody will see it anyway. + // that if nobody will see it anyway. if (!S.diagnosing()) return false; @@ -151,7 +151,7 @@ static bool diagnoseUnknownDecl(InterpState &S, CodePtr OpPC, } const SourceInfo &Loc = S.Current->getSource(OpPC); - if (S.getLangOpts().CPlusPlus23) { + if (S.getLangOpts().CPlusPlus23 && D->getType()->isReferenceType()) { S.FFDiag(Loc, diag::note_constexpr_access_unknown_variable, 1) << AK_Read << D; S.Note(D->getLocation(), diag::note_declared_at) << D->getSourceRange(); diff --git a/clang/test/SemaTemplate/deduction.cpp b/clang/test/SemaTemplate/deduction.cpp index a209615c36479..7be3f732508d7 100644 --- a/clang/test/SemaTemplate/deduction.cpp +++ b/clang/test/SemaTemplate/deduction.cpp @@ -1,6 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++23 +// RUN: %clang_cc1 -fsyntax-only -verify %s %std_cxx11- +// RUN: %clang_cc1 -fsyntax-only -verify %s %std_cxx11- -fexperimental-new-constant-interpreter // Template argument deduction with template template parameters. template<typename T, template<T> class A> _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
