Android Studio C ++ native compiler does not understand smart pointer promotion

My Android Studio built-in compiler is showing me an error when passing a unique_ptr

derived class to a function expecting a unique_ptr

parent class. But the code compiles as I expected.

enter image description here

The error message from the code snippet above:

Parameter type mismatch: Class 'std::unique_ptr<B>' is not compatible with class 'std::unique_ptr<A>'

      

I think this is a bug related to Android Studio? I was wondering if there are options for this error checking, nothing to find

EDIT: Please note that this code compiles without compiler errors (the bug I quoted is Android Studio's real-time authentication). You can check the code here: https://ideone.com/xlUsKs

+3


source to share





All Articles