// { dg-do compile { target c++11 } } // { dg-options "-Wignored-qualifiers" } // c++/80544 cast expressions returned cv-qualified prvalues template void f(T&&) { } template void f(T const&&) = delete; template void g(T&&) = delete; template void g(T const&&) { } struct B { int i; const char c; } b = {}; void f1() { int i = 0; f((long const)i); // { dg-warning "5:type qualifiers ignored" } f((int* const)&i); // { dg-warning "5:type qualifiers ignored" } f((int const* const)&i); // { dg-warning "5:type qualifiers ignored" } f((long* const)&i); // { dg-warning "5:type qualifiers ignored" } f(static_cast(i)); // { dg-warning "5:type qualifiers ignored" } f(reinterpret_cast(&i)); // { dg-warning "5:type qualifiers ignored" } f(static_cast(&i)); // { dg-warning "5:type qualifiers ignored" } f(const_cast(&i)); // { dg-warning "5:type qualifiers ignored" } f(reinterpret_cast(&i)); // { dg-warning "5:type qualifiers ignored" } using ptrmem = int B::*; f(static_cast(&B::i)); // { dg-warning "5:type qualifiers ignored" } f(const_cast(&B::i)); // { dg-warning "5:type qualifiers ignored" } f(reinterpret_cast(&B::i)); // { dg-warning "5:type qualifiers ignored" } // No warnings, not a cv-qualified type: using ptrmem2 = const char B::*; f(static_cast(&B::c)); f(const_cast(&B::c)); f(reinterpret_cast(&B::c)); // prvalue of class type can have cv-quals: g(static_cast(b)); }