On 06/11/2013 07:23 PM, david.hagood@xxxxxxxxx wrote:
The dynamic_cast operator shall not cast away constness (5.2.11). class A { }; class B : public A { }; int main() { A* a; B* b = new B(); a = dynamic_cast<const A*>(b); return 0; }You aren't casting *away* const-ness, you are adding const-ness (and then discarding it when you assign to A - which should be an error).
I agree about the error part—Andrey, could you please file a bug? -- Florian Weimer / Red Hat Product Security Team