[cfe-dev] Clang/C++ problem?
Marshall Clow
mclow.lists at gmail.com
Mon Jan 24 13:56:28 PST 2011
On Jan 24, 2011, at 1:33 PM, Steven Watanabe wrote:
> AMDG
>
> On 1/24/2011 1:08 PM, Marshall Clow wrote:
>> Shouldn't this work?
>
> My gut feel reaction is that it shouldn't,
> but I haven't actually checked the standard.
>
>> 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;
>>> }
>>>
>>
>
> What about something simpler?
> Does
>
> typedef int Foo_t;
> typedef unsigned Foo_t uFoo_t;
No it does not - but gcc doesn't accept it either.
$ g++ junk.cpp
junk.cpp:2: error: invalid combination of multiple type-specifiers
On the other hand, clang doesn't like this (and gcc thinks that it's fine)
DoSomething ((unsigned Foo_t)(foo));
I've opened bug #9040, but I'm still updating it.
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