Re: Cannot find source of undefined identifier

From: John Harrison (john_andronicus_at_hotmail.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 22:31:44 +0100


>
> The error is related to two-pahse name lookup, when a compiler
> supports this feature, identifiers in templates are bound
> when the template is first parsed, unless the name is dependant
> on a template paramiter. All of the 3 options above tell the
> compiler that 'is_goal' is a dependant name.
>

Foolishly I thought I'd try and work this out from the standard. Since I've
never thoroughly understood dependent name lookup I've probably made a
mistake but as far as I can tell is_goal is a dependent name.

14.6.2 para 1 says that in expressions of the form

identifier ( expression-list )

identifier is a dependent name if and only if and of the expressions in
expression-list are type-dependent expressions. In this case then only
expression is current_state.

14.6.2.2 para 3 says that current_state is type dependent name since it was
declared with a template parameter (STATE_T)

Therefore is_goal is a dependent name and should be looked up when the
template is instantiated not when it is parsed.

Where's the mistake in my reasoning?

john



Relevant Pages

  • Namespace problems when compiling (xutility)
    ... I am trying to compile my project with MTL (Matrix Template Library) and I am ... undeclared identifier ...
    (microsoft.public.vc.language)
  • Re: Fortran templates
    ... different classes of expressions: ordinary expressions, ... initialization expressions, and specification expressions. ... in our template code we must ... template subroutine swap ...
    (comp.lang.fortran)
  • Re: template keyword needed
    ... template" and "incomplete type" are two separate, ... Neither is a dependent name. ... You need to know what T is in order to know which namespaces are ...
    (microsoft.public.vc.language)
  • Re: name binding from one template to another
    ... What most people and books call "dependent name" doesn't appear to ... template definition and the context of the point of instantiation. ... these dependent names - so called two-phase lookup. ... expression that involves template parameters is dependent. ...
    (microsoft.public.vc.language)
  • Re: msvc++ 2005 template question
    ... following source snippet: ... template <class EOT> ... The issue here is that, as the error message explains, a dependent ... it's a name whose definition depends on one or more template parameters. ...
    (microsoft.public.vc.language)