Re: break in statement expression in while condition fails to compile

2013-12-11 Thread Jakub Jelinek
On Wed, Dec 11, 2013 at 07:13:47PM +0530, Prathamesh Kulkarni wrote: > >From the bug-report (comment 4): > Here is what the c++ standard says : > "The break statement shall occur only in an iteration-statement or a switch > statement and causes termination of the smallest enclosing iteration-statem

Re: break in statement expression in while condition fails to compile

2013-12-11 Thread Prathamesh Kulkarni
On Tue, Dec 10, 2013 at 10:16 PM, Florian Weimer wrote: > On 12/10/2013 02:21 PM, Prathamesh Kulkarni wrote: >> >> The following code fails to compile with gcc-4.8.2. >> >> int main(void) >> { >> while ( ({ break; 0; }) ) >> ; >> return 0; >> } >> >> foo.c:3:14: error: break sta

Re: break in statement expression in while condition fails to compile

2013-12-10 Thread Florian Weimer
On 12/10/2013 02:21 PM, Prathamesh Kulkarni wrote: The following code fails to compile with gcc-4.8.2. int main(void) { while ( ({ break; 0; }) ) ; return 0; } foo.c:3:14: error: break statement not within loop or switch while ( ({ break; 0; }) ) ^ Is this

break in statement expression in while condition fails to compile

2013-12-10 Thread Prathamesh Kulkarni
The following code fails to compile with gcc-4.8.2. int main(void) { while ( ({ break; 0; }) ) ; return 0; } foo.c:3:14: error: break statement not within loop or switch while ( ({ break; 0; }) ) ^ Is this a compile-error or is it a bug in GCC ? clang-3.2 seems to