Topic: member initialisers and anonymous unions
Author: kevlin@wslint.demon.co.uk (Kevlin Henney)
Date: Wed, 18 Jan 1995 09:23:19 +0000 Raw View
I have scoured the ARM and the WP, but cannot find clarification one way
or t'other as to whether the following is legal:
class Union
{
union { int *i; void *p; };
public:
Union(int j) : i(j) {}
Union(void *q) : p(q) {}
};
Trial by compiler says 'no', common sense suggests 'yes', and the relevant
documents seem to say 'dunno'.
[I'm after clarification, not solutions - after all this is comp.std.c++
and not comp.lang.c++ :-) and it's a SMOP to work around the problem]
+---------------------------+-------------------------------------------+
| Kevlin A P Henney | Human vs Machine Intelligence: |
| kevlin@wslint.demon.co.uk | Humans can wreck a nice beach more easily |
| Westinghouse Systems Ltd | |
+---------------------------+-------------------------------------------+