[c++] weird conflict with template template parameter taking subtype of previous parameter as a non-type ordinal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.5 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: gcc-4.5
The following code will not compile:
template <int i>
struct LabelTypeMap { typedef int type_t; };
template <bool>
struct Hold { typedef int type; };
template<typename Holder, template<typename Holder::type> class typeMap>
struct Whatever { };
template <bool Enable>
struct Now { typedef Whatever<
int main()
{ Now<true>
i get these errors:
error: type/value mismatch at argument 2 in template parameter list for ‘template<class Holder, template<typename Holder::type <anonymous> > class typeMap> struct Whatever’
expected a template of type ‘template<typename Holder::type <anonymous> > class typeMap’, got ‘template<int i> struct LabelTypeMap’
Hint: if i replace this:
template <bool Enable>
struct Now { typedef Whatever<
with this:
template <bool Enable>
struct Now { typedef Whatever<
it builds just fine.
tested versions:
g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
g++-4.5 (Ubuntu/Linaro 4.5.1-7ubuntu2) 4.5.1
Description: Ubuntu 10.10
Release: 10.10