Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-02-24 14:43:43

I mentioned in another post that was having compilers problems with one of
my projects. I've already posted the problem on comp.lang.c++, but Google
doesn't have it yet, so I'll try to repeat it here:

The problem is in a template parameter description in "random.hpp", lines
383 through 391:

> // L'Ecuyer 1988
> template<class MLCG1, class MLCG2,
> typename MLCG1::result_type
> #else
> int32_t
> #endif
> val>
> class additive_combine

The rest of the class template continues from there. The problem is that my
compiler chokes on the fourth line ("typename MLCG1::result_type") here,
claiming something like "illegal name overloading."

I guess the problem is an ambiguity between the types of template

1. A type
    A. "class" [formal_parameter_name ["=" default_value]]
    B. "typename" [formal_parameter_name ["=" default_value]]
2. Another template
    A. "template" "<" template_parameter_list ">" [formal_parameter_name
["=" default_value]]
3. A value
    A. type_name [formal_parameter_name ["=" default_value]]

When using a type name that is within a class template, you have to use the
"typename outer_type::inner_type" syntax. That is what the writer did here.
However, this case of 3A also looks like 1B! The compiler is choosing 1B,
then choking because the formal_parameter isn't a single identifier.

The ironic part is that I'm not using this class, but another from the same
header. Is this an ambiguity that the original writer's compiler missed, or
is my compiler wrong? Either way, we have to make some sort of work around.
Maybe we have to have that parameter always be "int32_t"?

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at, gregod at, cpdaniel at, john at