[cfe-dev] Clang/C++ problem?

Csaba Raduly rcsaba at gmail.com
Tue Jan 25 00:51:28 PST 2011


On Mon, Jan 24, 2011 at 10:08 PM, Marshall Clow  wrote:
> Shouldn't this work?
> If it should work, should I write up a bug?
>
> $ cat junk.cpp
>> typedef int Foo_t;
>>
>> template <typename T>
>> T DoSomething ( T t) { return t; }
>>
>> int main ( int argc, char *argv [] ) {
>>     int foo = 23;
>>     DoSomething ( static_cast<unsigned int>(foo));
>>     DoSomething ( static_cast<unsigned Foo_t>(foo));
>>     return 0;
>>     }
>>
>
> $ g++ junk.cpp
>
> $ clang junk.cpp
>> junk.cpp:9:36: error: expected '>'
>>         DoSomething ( static_cast<unsigned Foo_t>(foo));
>>                                           ^
>>                                           >
>> junk.cpp:9:27: note: to match this '<'
>>         DoSomething ( static_cast<unsigned Foo_t>(foo));
>>                                  ^
>> 1 error generated.
>>

The online version of Comeau C++ 4.3.10.1 produced the same errors:

"ComeauTest.c", line 12: error: expected a ">"
      DoSomething ( static_cast<unsigned Foo_t>(foo));
                                         ^

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
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