Created on 2002-07-11.00:00:00 last changed 269 months ago
Notes from October 2002 meeting:
6.7.4 [basic.life] paragraph 6 indicates that the references here are valid. It's permitted to take the address of a class object before it is fully initialized, and it's permitted to pass it as an argument to a reference parameter as long as the reference can bind directly. Except for the failure to cast the pointers to void * for the %p in the printfs, these examples are standard-conforming.
Is the following code well-formed?
struct A { /* */ }; int main() { A a=a; }
Note, that { int a=a; } is pretty legal.
And if so, what is the semantics of the self-initialization of UDT? For example
#include <stdio.h> struct A { A() { printf("A::A() %p\n", this); } A(const A& a) { printf("A::A(const A&) %p %p\n", this, &a); } ~A() { printf("A::~A() %p\n", this); } }; int main() { A a=a; }
can be compiled and prints:
A::A(const A&) 0253FDD8 0253FDD8 A::~A() 0253FDD8
(on some implementations).
History | |||
---|---|---|---|
Date | User | Action | Args |
2002-11-08 00:00:00 | admin | set | messages: + msg785 |
2002-11-08 00:00:00 | admin | set | status: open -> nad |
2002-07-11 00:00:00 | admin | create |