[c++] weird conflict with template template parameter taking subtype of previous parameter as a non-type ordinal

Bug #682249 reported by charles James Leonardo
6
This bug affects 1 person
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<Hold<Enable>, LabelTypeMap> concrete_t; };

int main()
{ Now<true>::concrete_t t; };

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<Hold<Enable>, LabelTypeMap> concrete_t; };

with this:
template <bool Enable>
struct Now { typedef Whatever<Hold<true>, LabelTypeMap> concrete_t; };

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.