You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
structA {
staticint b;
};
structB {
B(int);
B operator()();
using b=int;
};
namespaceP {
B A(decltype(A())::b);
}
If P::A is a variable, the A in what is then its initializer refers to it, so the decltype is B and B::b is int, so its declaration should be a function declaration instead. If P::A is a function, it's not available for lookup in its parameter list (which is part of its declarator; see [basic.scope.pdecl]/1), so A is ::A, the decltype is A, and A::b is a variable, so its declaration should be a variable declaration after all.
Implmentations agree that P::A is a variable but use the interpretation of decltype(A()) that finds ::A, presumably from some trial parse.
Suggested resolution:
Perhaps the prohibition on using A in a template argument in its initializer ([stmt.ambig]/3) needs to be extended to decltype, although it's not clear that there is no third way to refer to a variable or something shadowed by it in its own initializer in a way that would produce a type or value respectively.
The text was updated successfully, but these errors were encountered:
Reference (section label): [stmt.ambig]
Issue description:
Consider
If
P::A
is a variable, theA
in what is then its initializer refers to it, so thedecltype
isB
andB::b
isint
, so its declaration should be a function declaration instead. IfP::A
is a function, it's not available for lookup in its parameter list (which is part of its declarator; see [basic.scope.pdecl]/1), soA
is::A
, thedecltype
isA
, andA::b
is a variable, so its declaration should be a variable declaration after all.Implmentations agree that
P::A
is a variable but use the interpretation ofdecltype(A())
that finds::A
, presumably from some trial parse.Suggested resolution:
Perhaps the prohibition on using
A
in a template argument in its initializer ([stmt.ambig]/3) needs to be extended todecltype
, although it's not clear that there is no third way to refer to a variable or something shadowed by it in its own initializer in a way that would produce a type or value respectively.The text was updated successfully, but these errors were encountered: