[clang] Don't crash classifying a dependent splice expression - #310
Open
Cfretz244 wants to merge 1 commit into
Open
[clang] Don't crash classifying a dependent splice expression#310Cfretz244 wants to merge 1 commit into
Cfretz244 wants to merge 1 commit into
Conversation
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.
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #309.
A dependent
CXXSpliceExpris 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 whenSema::DeduceAutoTypededuces anautonon-type template parameter fromtypename probe<([:mem:])>inside a requires-expression type-requirement — trippeddyn_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 theauto-NTTP and fixed-NTTP probe forms over constant-readable and declared-only static members.Validation (Apple Silicon, Release+assertions, base
837da39):clang/test/Reflectionis at parity with base (15/16;splice-exprs.cpppre-existing);