Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/lib/AST/ComputeDependence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ ExprDependence clang::computeDependence(GenericSelectionExpr *E,
: ExprDependence::None;
for (auto *AE : E->getAssocExprs())
D |= AE->getDependence() & ExprDependence::Error;
for (auto *TSI : E->getAssocTypeSourceInfos())
if (TSI && TSI->getType()->containsErrors())
D |= ExprDependence::Error;

if (E->isExprPredicate())
D |= E->getControllingExpr()->getDependence() & ExprDependence::Error;
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Sema/generic-selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ int __attribute__((overloadable)) test (int);
double __attribute__((overloadable)) test (double);
char testc(char);

int f(int);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this so far away from the actual test?
Also, is it really needed to reproduce the issue? https://godbolt.org/z/Ych9r74eo


void PR30201(void) {
_Generic(4, char:testc, default:test)(4); // ext-warning {{'_Generic' is a C11 extension}}
}
Expand Down Expand Up @@ -86,3 +88,5 @@ void GH55562(void) {
struct S s = { 0 };
int i = s.a;
}

char *a = _Generic("", char (*)[f(x)]: ""); // expected-error {{use of undeclared identifier 'x'}} ext-warning {{'_Generic' is a C11 extension}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be useful to follow the example of other tests and put this into a function that is named after the issue number