summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/generic-selection.c
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-11-05 00:06:05 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-11-05 00:06:05 +0000
commitb035cd7ea4d59e7e76412940351f693ec421e15e (patch)
treec0d9832c709e89fecc726701ae3d1fb226fd0608 /clang/test/Sema/generic-selection.c
parente5739981d5f4e3b9f62af10a8eb3b2ec18f807dc (diff)
downloadbcm5719-llvm-b035cd7ea4d59e7e76412940351f693ec421e15e.tar.gz
bcm5719-llvm-b035cd7ea4d59e7e76412940351f693ec421e15e.zip
The control expression for a _Generic selection expression should have
its type decayed and qualifiers stripped when determining which selection it matches. Fixes PR16340. llvm-svn: 252104
Diffstat (limited to 'clang/test/Sema/generic-selection.c')
-rw-r--r--clang/test/Sema/generic-selection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/generic-selection.c b/clang/test/Sema/generic-selection.c
index 8cef975c709..0563ec0f4fc 100644
--- a/clang/test/Sema/generic-selection.c
+++ b/clang/test/Sema/generic-selection.c
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+void g(void);
+
void foo(int n) {
(void) _Generic(0,
struct A: 0, // expected-error {{type 'struct A' in generic association incomplete}}
@@ -23,4 +25,10 @@ void foo(int n) {
int a4[_Generic(0L, default: 1, short: 2, float: 3, int: 4) == 1 ? 1 : -1];
int a5[_Generic(0, int: 1, short: 2, float: 3) == 1 ? 1 : -1];
int a6[_Generic(0, short: 1, float: 2, int: 3) == 3 ? 1 : -1];
+
+ int a7[_Generic("test", char *: 1, default: 2) == 1 ? 1 : -1];
+ int a8[_Generic(g, void (*)(void): 1, default: 2) == 1 ? 1 : -1];
+
+ const int i = 12;
+ int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
}
OpenPOWER on IntegriCloud