5 ms·
Yeah, good luck with this one then: template <typename foo> void func() { foo::a < foo::b , foo::c > d; }
by john_moscow 7y ago
Yeah, good luck with this one then:
template <typename foo> void func()
{
foo::a < foo::b , foo::c > d;
}
- fusilli_jerry 7y agoThis is still not ambiguous: in order for 'foo::a' to be a template, 'a' must be prefixed with the 'template' disambiguator keyword, and in fact for any of a, b, or c to be types at all they would have to be prefixed with 'typename'. As written, it must parse as two expressions; if 'foo::a' turns out to be a class template at instantiation time, it's an error.
- MauranKilom 7y agoTwo-phase lookup requires this to be interpreted at template parse time as two comparisons and a comma operator, because a, b and c are dependent names (which, without further disambiguation with the typename or template keyword, are taken to be variables). This has been the case since the first ISO C++ standard (published in 1998).