------- Comment #2 from pinskia at gmail dot com  2010-07-21 02:53 -------
Subject: Re:   New: Invalid ambiguity on partial class specialization matching



On Jul 20, 2010, at 7:43 PM, "rodolfo at rodsoft dot org"
<gcc-bugzi...@gcc.gnu.org 
 > wrote:

> The following code doesn't compile unless variable RUNTIME is  
> defined as a
> "static const int" instead of an "enum":
>

This enum value has an anonymous type which is not valid in the  
context of templates in C++03/98. It is valid in the current draft of C 
++0x though. But I cannot remember if 4.5 implements that rule for - 
std=gnu++0x (-std=c++0x).



> #include <type_traits>
>
> enum { RUNTIME = 0 };
> // it compiles with the previous line commented out and the next  
> commented in
> // static const int RUNTIME=0;
>
> template <class T, class U, class EN=void> struct foo;
>
> template <template<int> class V, int M>
> struct foo<V<M>,V<M>, typename std::enable_if<M==RUNTIME ||  
> M==2>::type> {};
>
> template <template<int> class V1, template<int> class V2, int M>
> struct foo<V1<M>,V2<M>, typename std::enable_if<M==RUNTIME ||  
> M==2>::type> {};
>
> template <int M> struct bar {};
>
> foo<bar<2>,bar<2>> x;
>
>
> -- 
>           Summary: Invalid ambiguity on partial class specialization
>                    matching
>           Product: gcc
>           Version: 4.5.0
>            Status: UNCONFIRMED
>          Severity: normal
>          Priority: P3
>         Component: c++
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: rodolfo at rodsoft dot org
> GCC build triplet: x86_64-pc-linux-gnu
>  GCC host triplet: x86_64-pc-linux-gnu
> GCC target triplet: x86_64-pc-linux-gnu
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45012
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45012

Reply via email to