diff options
| author | Gangzheng Tong <tonggangzheng@gmail.com> | 2025-09-16 12:51:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-16 19:51:43 +0000 |
| commit | afb8146e10626887e3eb9f479480d4f8a1ad6128 (patch) | |
| tree | 4a11668df1005f4c15e7e25d27615e3116961356 /source/slang/slang-parser.cpp | |
| parent | 8ad0ae17880480abe587617c997ab28b23abc146 (diff) | |
Diagnose error when the function args can't satisfy constexpr parameter requirements (#7269)
## Summary
This PR enhances constexpr validation by adding proper error checking
when function arguments cannot satisfy constexpr parameter requirements,
addressing issue #6370.
## Problem
Previously, when a function declared constexpr parameters, the compiler
would attempt to propagate constexpr-ness to the call site arguments,
but there was insufficient validation and error reporting when this
propagation failed. This could lead silent failures where constexpr
requirements weren't properly enforced
## Solution
This PR adds checks that:
1. **Validates constexpr arguments**: When a function parameter is
marked as `constexpr`, the compiler now explicitly checks that the
corresponding argument can be marked as `constexpr`
2. **Issues clear compilation errors**: added
`Diagnostics::argIsNotConstexpr`)
3. **Handles both call scenarios**: The validation works for both:
- Direct function calls with IR-level function definitions
- Calls to function from external modules
Fixes #6370
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-parser.cpp')
0 files changed, 0 insertions, 0 deletions
