Author: rjmccall
Date: Mon Feb 11 20:08:12 2013
New Revision: 174930
URL: http://llvm.org/viewvc/llvm-project?rev=174930&view=rev
Log:
Perform placeholder conversions on the controller of a _Generic
expression.
Added:
cfe/trunk/test/SemaObjC/generic-selection.m
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=174930&r1=174929&r2=174930&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Feb 11 20:08:12 2013
@@ -1173,6 +1173,12 @@ Sema::CreateGenericSelectionExpr(SourceL
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
Added: cfe/trunk/test/SemaObjC/generic-selection.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/generic-selection.m?rev=174930&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/generic-selection.m (added)
+++ cfe/trunk/test/SemaObjC/generic-selection.m Mon Feb 11 20:08:12 2013
@@ -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);
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits