[cfe-dev] Error on valid; and q. about using tentative parse
Douglas Gregor
dgregor at apple.com
Wed Feb 6 14:21:52 PST 2013
On Feb 6, 2013, at 12:43 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Wed, Feb 6, 2013 at 10:24 PM, Robinson, Paul
> <Paul.Robinson at am.sony.com> wrote:
>> Clang is giving a compile time error on the following test case:
>>
>> template<int V0>
>> struct T0
>> {
>> enum { E = V0 };
>> };
>>
>> template<int V1>
>> struct T1
>> {
>> // The name declared here is the same as the type template
>> // declared above.
>> static int const T0 = T0<V1>::E;
>> };
>>
>> with the compile time error:
>>
>> test.cpp:12:35: error: no member named 'E' in the global namespace
>> static int const T0 = T0<V1>::E;
>
> I believe this is correct, the code is parsed as (T0 less-than V1)
> greater-than ::E.
>
> ::T0<V1>::E would do what you want.
Right. For fun, add
const int E = 17;
to the global scope :)
- Doug
More information about the cfe-dev
mailing list