The disambiguation is purely syntactic; that is, the meaning of the
names occurring in such a statement, beyond whether they are
type-names or not, is not generally used in or changed by the
disambiguation
. Class templates are instantiated as necessary to
determine if a qualified name is a
type-name. Disambiguation
precedes parsing, and a statement disambiguated as a declaration may be
an ill-formed declaration
. If, during parsing, a name in a template
parameter is bound differently than it would be bound during a trial
parse, the program is ill-formed
. No diagnostic is required
. [
Note 2:
This can occur only when the name is declared earlier in the
declaration
. —
end note]
[
Example 3:
struct T1 {
T1 operator()(int x) { return T1(x); }
int operator=(int x) { return x; }
T1(int) { }
};
struct T2 { T2(int){ } };
int a, (*(*b)(T2))(int), c, d;
void f() {
T1(a) = 3,
T2(4),
(*(*b)(T2(c)))(int(d));
}
—
end example]