Regarding my test case, it is taken almost directly from the C++11 standard I
have, and it says the call to the member function 'f' on line 31 of my test
case is undefined behavior. Though I'd imagine it would work fine on any
reasonable compiler, as it is from the base class B which at that point is
initialized as you mentioned.
12.6.2p13 //However, if these operations// [member function calls as far as
this patch considers]// are performed in a ctor-initializer (or in a function
called directly or indirectly from a ctor-initializer) before all the
mem-initializers for base classes have completed, the result of the operation
is undefined.//
class D : public B, C {
int i;
public:
D() : C(f()), //undefined: calls member function
//but base C not yet initialized
i(f()) { } //well-defined: bases are all initialized
};
I was hoping to keep this warning as strict as possible, though I realize it is
a little surprising. I apologize for not including that context in my summary.
I'm new to all of this!
Thank you for the comments and review. I will get to work on everything you
mentioned, and I'll make sure to include the full diff next time.
http://reviews.llvm.org/D6561
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits