diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-04-20 08:23:18 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-04-20 08:23:18 +0000 |
commit | 3a1e692fed745fbcec2c2692b8e0d189d2b93851 (patch) | |
tree | 1e3d7ec23513cf17b31a603dc685d601f338d061 /clang/test/Sema/expr-address-of.c | |
parent | d67efaa8471c8ad67aba4ef2ec82dc9d94bc0de2 (diff) | |
download | bcm5719-llvm-3a1e692fed745fbcec2c2692b8e0d189d2b93851.tar.gz bcm5719-llvm-3a1e692fed745fbcec2c2692b8e0d189d2b93851.zip |
Some cleanup and bug-fixing for address-of checking. This causes a couple of
minor accepts-invalid regressions, but we weren't really rejecting them for
the right reason. We really need a more general solution to detect all the
cases of the promotion of arrays with a register storage class.
llvm-svn: 69586
Diffstat (limited to 'clang/test/Sema/expr-address-of.c')
-rw-r--r-- | clang/test/Sema/expr-address-of.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/test/Sema/expr-address-of.c b/clang/test/Sema/expr-address-of.c index b3ea9c50668..909acfb2666 100644 --- a/clang/test/Sema/expr-address-of.c +++ b/clang/test/Sema/expr-address-of.c @@ -45,18 +45,21 @@ void f0() { int *_dummy1 = &(*(x1 + 1)); } +// FIXME: The checks for this function are broken; we should error +// on promoting a register array to a pointer! (C99 6.3.2.1p3) void f1() { register int x0[10]; - int *_dummy0 = &(*x0); // expected-error {{address of register variable requested}} + int *_dummy00 = x0; // fixme-error {{address of register variable requested}} + int *_dummy01 = &(*x0); // fixme-error {{address of register variable requested}} register int x1[10]; - int *_dummy1 = &(*(x1 + 1)); // expected-error {{address of register variable requested}} + int *_dummy1 = &(*(x1 + 1)); // fixme-error {{address of register variable requested}} register int *x2; int *_dummy2 = &(*(x2 + 1)); register int x3[10][10][10]; - int *_dummy3 = &x3[0][0]; // expected-error {{address of register variable requested}} + int (*_dummy3)[10] = &x3[0][0]; // expected-error {{address of register variable requested}} register struct { int f0[10]; } x4; int *_dummy4 = &x4.f0[2]; // expected-error {{address of register variable requested}} @@ -94,3 +97,13 @@ void f5() { void f6(register int x) { int * dummy0 = &x; // expected-error {{address of register variable requested}} } + +char* f7() { + register struct {char* x;} t1 = {"Hello"}; + char* dummy1 = &(t1.x[0]); + + struct {int a : 10;} t2; + int* dummy2 = &(t2.a); // expected-error {{address of bit-field requested}} + + void* t3 = &(*(void*)0); +} |