[cfe-dev] Error on valid; and q. about using tentative parse

Dmitri Gribenko gribozavr at gmail.com
Wed Feb 6 12:43:38 PST 2013


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.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list