[all-commits] [llvm/llvm-project] 720df3: [os_log] Fix a CodeGen crash for non-trivial C++ a...

Akira Hatanaka via All-commits all-commits at lists.llvm.org
Fri May 29 17:24:18 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 720df36d34e734f40a09f3d5a909353af619128b
      https://github.com/llvm/llvm-project/commit/720df36d34e734f40a09f3d5a909353af619128b
  Author: Akira Hatanaka <ahatanak at gmail.com>
  Date:   2026-05-29 (Fri, 29 May 2026)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/SemaCXX/os_log.cpp

  Log Message:
  -----------
  [os_log] Fix a CodeGen crash for non-trivial C++ arguments (#200320)

The earlier fix in commit 8a0d145d90df (#158744) only emitted a hard
error for os_log arguments of record or complex type that took the
VarArgKind::Valid / ValidInCXX11 path in checkFormatExpr. Arguments of
non-trivial C++ class type (non-trivial copy/move ctor or dtor) instead
take the VarArgKind::Undefined path, which only emitted the
-Wnon-pod-varargs warning and let compilation proceed into CodeGen.

There, emitBuiltinOSLogFormat passes the argument expression to
EmitScalarExpr, which requires a scalar type. A non-trivial class
argument is not a scalar, so CodeGen crashes (asserting in
hasScalarEvaluationKind in assertions builds).

Emit the hard error err_format_conversion_argument_type_mismatch on the
Undefined path too, so compilation stops before CodeGen.

rdar://174747930



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