Skip to content

[clang] Don't crash classifying a dependent splice expression - #310

Open
Cfretz244 wants to merge 1 commit into
bloomberg:p2996from
Cfretz244:reflect-dependent-splice-classification
Open

[clang] Don't crash classifying a dependent splice expression#310
Cfretz244 wants to merge 1 commit into
bloomberg:p2996from
Cfretz244:reflect-dependent-splice-classification

Conversation

@Cfretz244

Copy link
Copy Markdown

Fixes #309.

A dependent CXXSpliceExpr is created with a null model expression (BuildReflectionSpliceExpr's dependent tail). Expr classification unconditionally dereferenced the model, so classifying a dependent splice — reachable at parse time when Sema::DeduceAutoType deduces an auto non-type template parameter from typename probe<([:mem:])> inside a requires-expression type-requirement — tripped dyn_cast on a non-existent value (Casting.h:662).

Classify a model-less splice by its own value kind instead.

Includes a regression test (libcxx/test/std/experimental/reflection/auto-nttp-dependent-splice-requires.pass.cpp) covering both the auto-NTTP and fixed-NTTP probe forms over constant-readable and declared-only static members.

Validation (Apple Silicon, Release+assertions, base 837da39):

  • the repro ICEs at pristine base and compiles clean with this change (verified both directions by reverting just this file);
  • clang/test/Reflection is at parity with base (15/16; splice-exprs.cpp pre-existing);
  • the new regression test passes.

A dependent CXXSpliceExpr is created with a null model expression
(BuildReflectionSpliceExpr's dependent tail). Expr classification
unconditionally dereferenced the model, so classifying a dependent splice
-- reachable at parse time when Sema::DeduceAutoType deduces an 'auto'
non-type template parameter from 'typename probe<([:mem:])>' inside a
requires-expression type-requirement -- tripped 'dyn_cast on a
non-existent value' (Casting.h:662).

Classify a model-less splice by its own value kind instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant