Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ambiguity resolution with "class Foo" and template-arguments

1 view
Skip to first unread message

Johannes Schaub (litb)

unread,
Dec 14, 2009, 12:40:28 PM12/14/09
to
Hello all. There are two ambiguities that i can't find a resolution to. The
first, which the note in 14.2/3 explains is:

template<class T> void f();

The note says "because of the name lookup rules, a template-parameter that
could be interpreted as either a non-type template-parameter or a type-
parameter (because its identifier is the name of an already existing class)
is taken as a type-parameter.". What does it mean by these "name lookup
rules"? Why isn't it parsed as an elaborated-type-specifier in a parameter-
declaration which introduces "T" as a new class-name if it doesn't exist
yet, and uses the already existing "T" that lookup found?

The second question is:

int const i = 0;
template<int> struct F;
F<i> f;

In this, the grammar in n3000 for "template-argument" contains both id-
expresssion and constant-expression as productions. What path to take? Is
there a paragraph that states this?

Thanks!

--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std...@netlab.cs.rpi.edu]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]

0 new messages