Created on 2002-06-17.00:00:00 last changed 47 months ago
Additional note (November, 2020):
Paper P1787R6, adopted at the November, 2020 meeting, partially addresses this issue.
Additional note (October, 2013):
Issue 1330 treats exception-specifications like default arguments, evaluated in the completed class type. That raises the same questions regarding self-referential noexcept clauses that apply to default arguments.
Additional note (March, 2013):
Additional discussion has occurred suggesting the following examples as illustrations of this issue:
struct B {
struct A { int a = 0; };
B(A = A()); // Not permitted?
};
as well as
struct C { struct A { int a = C().n; }; // can we use the default argument here? C(int k = 0); int n; }; bool f(); struct D { struct A { bool a = noexcept(B()); }; // can we use the default initializer here? struct B { int b = f() ? throw 0 : 0; }; };
(See also issue 325.)
Notes from the February, 2012 meeting:
Implementations seem to have come to agreement that this example is ill-formed.
Is this program well-formed?
struct S { static int f2(int = f1()); // OK? static int f1(int = 2); }; int main() { return S::f2(); }
A class member function can in general refer to class members that are declared lexically later. But what about referring to default arguments of member functions that haven't yet been declared?
It seems to me that if f2 can refer to f1, it can also refer to the default argument of f1, but at least one compiler disagrees.
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6270 |
2013-10-14 00:00:00 | admin | set | messages: + msg4651 |
2013-10-14 00:00:00 | admin | set | status: drafting -> open |
2013-03-18 00:00:00 | admin | set | messages: + msg4257 |
2012-02-27 00:00:00 | admin | set | messages: + msg3768 |
2012-02-27 00:00:00 | admin | set | status: open -> drafting |
2002-06-17 00:00:00 | admin | create |