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

Marshall Clow mclow.lists at gmail.com
Mon Jan 24 13:08:04 PST 2011


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.
> 

Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki





More information about the cfe-dev mailing list