Created on 2024-11-17.00:00:00 last changed 12 months ago
Suggested resolution:
Extend the prohibition on using A in a template argument (8.11 [stmt.ambig] paragraph 3 to decltype.
(From submission #643.)
Consider:
struct A {
static int b;
};
struct B {
B(int);
B operator()();
using b=int;
};
namespace P {
B A(decltype(A())::b);
}
If P::A is a variable, then decltype(A())::b is its initializer, and the A therein refers to the variable. That implies that the decltype is B and B::b is int, thus the declaration should be a function declaration instead.
If P::A is a function, then its name is not available for lookup in its parameter list (see 6.4.2 [basic.scope.pdecl] paragraph 1), so A is ::A and A::b is a varaible, thus the declaration should be a variable declaration instead.
Implementations agree that P::A is a variable, but use the interpretation of decltype(A()) that finds ::A, presumably from some trial parse.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2024-12-05 22:33:53 | admin | set | messages: + msg7908 |
| 2024-11-17 00:00:00 | admin | create | |