There's no way m_p2
can be accessed on the caller side from the code example that's provided.
Even then, this is very much breaking ABI technical speaking.
But if the assumption holds (100% sure that m_p2
isn't somehow exposed) then ABI would only break if changing that type pointed to could change the layout of the class.
That would seem a little strange though - even when it's impossible to give a guarentee at the c++ language level.
Therefore it is a matter of checking wrether the layout changes between the two versions for the specific setup. That can be checked with something like:
Foo* p = 0;
&p.m_p1;//offset to m_p1 (make a static member function for the check itself)
Since there's no virtual functions on Foo
we luckily do not need to worry about that for this class - otherwise that should be tested for as well to be absolutely sure.
The only thing thats left is any possible names that could be left - that would of course still be impossible to change - but in itself shouldn't break ABI.