[cfe-dev] clang++ bug or strict compliance?

Csaba Raduly rcsaba at gmail.com
Fri May 20 07:40:33 PDT 2011


On Fri, May 20, 2011 at 4:15 PM, Sebastian Redl  wrote:
>
> On 20.05.2011, at 07:29, Jack Howarth wrote:
>
>>   While building packages under fink using clang/clang++ 3.0svn, I ran into
>> the following code fragment, derived from apt, which produces the error...
(snip)
>
> Clang is right. A variable declared in a condition cannot be hidden by a variable in the immediately contained block.
>
> Sebastian

Comeau C++ agrees:

Comeau C/C++ 4.3.10.1 (Oct  6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C++ C++0x_extensions

"ComeauTest.c", line 15: error: "I", declared in for-loop
initialization, may not be
          redeclared in this scope
         char *I = S;
               ^

"ComeauTest.c", line 16: warning: variable "Start" is used before its
value is set
         for (; Start != End; Start++)
                ^

"ComeauTest.c", line 16: warning: variable "End" is used before its value is set
         for (; Start != End; Start++)
                         ^




-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds




More information about the cfe-dev mailing list