[clang] [clang][bytecode] Fix a diagnostic discrepancy (PR #177384)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 22 07:53:32 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
The current interpreter does _not_ evaluate function calls when checking for a potential constant expression.
However, it _does_ evaluate the initializers of constructors. In the bytecode interpreter, this is harder because we compile the initializers and the body of a constructor all in the same function.
Add a special opcode that we emit after the constructor initializers and that aborts when we're checking for a potential constant expression.
---
Full diff: https://github.com/llvm/llvm-project/pull/177384.diff
5 Files Affected:
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+6-1)
- (modified) clang/lib/AST/ByteCode/Interp.cpp (+5-6)
- (modified) clang/lib/AST/ByteCode/Interp.h (+10)
- (modified) clang/lib/AST/ByteCode/Opcodes.td (+2)
- (modified) clang/test/AST/ByteCode/functions.cpp (+24)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/177384
More information about the cfe-commits
mailing list