diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-06 15:21:59 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-06 15:21:59 +0000 |
commit | 1ea7fa601eb0c73e47f13a8b1bf16975123a8050 (patch) | |
tree | b8c296e8aca98162130737ac16548bd0553c78f3 /gcc/testsuite/gcc.dg/pr13519-1.c | |
parent | e7917d1d4f1bb33d0cac6c26793e52d87f468032 (diff) | |
download | gcc-1ea7fa601eb0c73e47f13a8b1bf16975123a8050.tar.gz |
PR c/13519
* c-typeck.c (composite_type, common_pointer_type): New functions.
(common_type): Split parts into composite_type and
common_pointer_type. Ensure that arithmetic operations return
unqualified types without attributes. Don't make composite type
of signed enum and compatible integer be unsigned.
(build_conditional_expr, build_binary_op): Use
common_pointer_type.
* c-decl.c (merge_decls): Use composite_type.
* c-tree.h (composite_type): Declare.
testsuite:
* gcc.c-torture/enum-3.c, gcc.dg/pr13519-1.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82671 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr13519-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr13519-1.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr13519-1.c b/gcc/testsuite/gcc.dg/pr13519-1.c new file mode 100644 index 00000000000..907165f5f8e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr13519-1.c @@ -0,0 +1,47 @@ +/* typeof applied to const+nonconst should be nonconst, as should + typeof applied to other arithmetic expressions. Bug 13519. */ +/* Origin: Debian bug report 208981 + from Kalle Olavi Niemitalo <kon@iki.fi>, adapted to a testcase by + Joseph Myers <jsm@polyomino.org.uk>. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void fn(void) +{ + int n; + const int c; + + { __typeof__(n) a1; a1=0; } + { __typeof__(c) a2; a2=0; } /* { dg-error "read-only" "correct error" } */ + { __typeof__((int)n) a3; a3=0; } + { __typeof__((int)c) a4; a4=0; } /* { dg-bogus "read-only" "bogus error" { xfail *-*-* } } */ + { __typeof__((const int)n) a5; a5=0; } /* { dg-error "read-only" "correct error" { xfail *-*-* } } */ + { __typeof__((const int)c) a6; a6=0; } /* { dg-error "read-only" "correct error" } */ + { __typeof__(0) a7; a7=0; } + { __typeof__(1) a8; a8=0; } + + { __typeof__(n+n) b0; b0=0; } + { __typeof__(n+c) b1; b1=0; } + { __typeof__(c+n) b2; b2=0; } + { __typeof__(c+c) b3; b3=0; } + + { __typeof__(0+n) c0; c0=0; } + { __typeof__(0+c) c1; c1=0; } + { __typeof__(n+0) c2; c2=0; } + { __typeof__(c+0) c3; c3=0; } + + { __typeof__(1+n) d0; d0=0; } + { __typeof__(1+c) d1; d1=0; } + { __typeof__(n+1) d2; d2=0; } + { __typeof__(c+1) d3; d3=0; } + + { __typeof__(((int)n)+((int)n)) e0; e0=0; } + { __typeof__(((int)n)+((int)c)) e1; e1=0; } + { __typeof__(((int)c)+((int)n)) e2; e2=0; } + { __typeof__(((int)c)+((int)c)) e3; e3=0; } + + { __typeof__(((const int)n)+((const int)n)) f0; f0=0; } + { __typeof__(((const int)n)+((const int)c)) f1; f1=0; } + { __typeof__(((const int)c)+((const int)n)) f2; f2=0; } + { __typeof__(((const int)c)+((const int)c)) f3; f3=0; } +} |