[Clang][AST] Propagate error dependence for _Generic assoc types#6
Open
sdkrystian wants to merge 1 commit intocppalliance:mainfrom
Open
[Clang][AST] Propagate error dependence for _Generic assoc types#6sdkrystian wants to merge 1 commit intocppalliance:mainfrom
sdkrystian wants to merge 1 commit intocppalliance:mainfrom
Conversation
Endilll
reviewed
Feb 9, 2026
Endilll
left a comment
There was a problem hiding this comment.
This makes sense to me, but I don't feel I know enough about the surrounding code to affirm that this is the right fix in the right place.
| double __attribute__((overloadable)) test (double); | ||
| char testc(char); | ||
|
|
||
| int f(int); |
There was a problem hiding this comment.
Why is this so far away from the actual test?
Also, is it really needed to reproduce the issue? https://godbolt.org/z/Ych9r74eo
| int i = s.a; | ||
| } | ||
|
|
||
| char *a = _Generic("", char (*)[f(x)]: ""); // expected-error {{use of undeclared identifier 'x'}} ext-warning {{'_Generic' is a C11 extension}} |
There was a problem hiding this comment.
It would be useful to follow the example of other tests and put this into a function that is named after the issue number
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.
The following input crashes:
The crash is happens because a result-dependent
_Genericends up value-dependent withoutExprDependence::Error, tripping the assertion inCheckForConstantInitializerinSemaDecl.cpp.This patch propagates
ExprDependence::Errorfrom_Genericassociation types so result-dependent selections created during error recovery carry the error bit and avoid the constant-initializer assertion.Fixes 176929 in upstream.