diff options
author | Benjamin Kosnik <bkoz@gcc.gnu.org> | 1998-03-25 14:11:13 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 1998-03-25 14:11:13 +0000 |
commit | 56ee7837e9cadc7807cc4d95f096087cd0dc67f5 (patch) | |
tree | 4ee0086210264cabc99ed88add76ce8e330abd18 /gcc | |
parent | dba21b324a641191fbca5a481ec23b1d765cb718 (diff) | |
download | gcc-56ee7837e9cadc7807cc4d95f096087cd0dc67f5.zip gcc-56ee7837e9cadc7807cc4d95f096087cd0dc67f5.tar.gz gcc-56ee7837e9cadc7807cc4d95f096087cd0dc67f5.tar.bz2 |
�
test cases for g++15235
From-SVN: r18830
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C new file mode 100644 index 0000000..c17c935 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/bool02.C @@ -0,0 +1,63 @@ +//980324 bkoz +//test for bool and bitwise ands + +#include <assert.h> + + +void bar ( bool x ) {}; +void bars ( short x ) {}; + +#if 0 +int andb(){ + bool y; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 1 or 0 +} +#endif + +int andbtrue(){ + bool y = true; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 1 +} + +int andbfalse(){ + bool y = false; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 0 +} + +int andbfalse2(){ + bool y = 0; + bar ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 0 +} + +int ands(){ + short y = 1; + bars ( y ); + int blob = ( 27 & int (y) ); + return blob; //expect 1 +} + + +int main() { + int tmp; +#if 0 + tmp = andb(); + assert (tmp == 1 || tmp == 0); +#endif + tmp = andbtrue(); + assert (tmp == 1); + tmp = andbfalse(); + assert (tmp == 0); + tmp = andbfalse2(); + assert (tmp == 0); + tmp = ands(); + assert (tmp == 1); + return 0; +} |