diff options
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 6 | ||||
-rw-r--r-- | test/SemaObjC/generic-selection.m | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 689c1497fd..f6c6fe118e 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1173,6 +1173,12 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc, TypeSourceInfo **Types, Expr **Exprs, unsigned NumAssocs) { + if (ControllingExpr->getType()->isPlaceholderType()) { + ExprResult result = CheckPlaceholderExpr(ControllingExpr); + if (result.isInvalid()) return ExprError(); + ControllingExpr = result.take(); + } + bool TypeErrorFound = false, IsResultDependent = ControllingExpr->isTypeDependent(), ContainsUnexpandedParameterPack diff --git a/test/SemaObjC/generic-selection.m b/test/SemaObjC/generic-selection.m new file mode 100644 index 0000000000..70c77dc45d --- /dev/null +++ b/test/SemaObjC/generic-selection.m @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +__attribute__((objc_root_class)) +@interface Root { + Class isa; +} +@end + +@interface A +@property (strong) id x; +@end + +// rdar://13193560 +void test0(A *a) { + int kind = _Generic(a.x, id : 0, int : 1, float : 2); +} |