[all-commits] [llvm/llvm-project] 071765: [clang] Improve constexpr-unknown diagnostics. (#1...

Eli Friedman via All-commits all-commits at lists.llvm.org
Mon Jul 7 23:35:32 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 071765749a70b22fb62f2efc07a3f242ff5b4c52
      https://github.com/llvm/llvm-project/commit/071765749a70b22fb62f2efc07a3f242ff5b4c52
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2025-07-07 (Mon, 07 Jul 2025)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticASTKinds.td
    M clang/lib/AST/APValue.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp
    M clang/test/SemaCXX/constant-expression-p2280r4.cpp

  Log Message:
  -----------
  [clang] Improve constexpr-unknown diagnostics. (#146288)

APValue::ConstexprUnknown() constructs a broken LValue that doesn't have
an lvalue path, which confuses later error handling. It turns out we
don't actually use the result of createConstexprUnknownAPValues for
anything, so just stop using it. Just construct the LValue directly when
we need it.

Make findCompleteObject emit errors more aggressively; allowing it to
succeed for constexpr-unknown objects leads to weird states where it
succeeds, but doesn't return a well-formed object.

Delete the check for constexpr-unknown in dynamic_cast handling: it's
not necessary, and breaks with the other changes in this patch.

These changes allow us to produce proper diagnostics when something
fails to be evaluated, instead of just printing a generic top-level
error without any notes.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list