// P2864R2 - Remove Deprecated Arithmetic Conversion on Enumerations From C++26 // { dg-do compile { target c++20 } } enum A { a }; enum B { b }; template decltype (true ? X : Y) f1 () { throw 1; } // { dg-error "enumerated mismatch in conditional expression: 'A' vs 'B'" "" { target c++26 } .-1 } // { dg-error "conditional expression between enumeration type 'A' and floating-point type 'double'" "" { target c++26 } .-2 } // { dg-error "conditional expression between floating-point type 'double' and enumeration type 'A'" "" { target c++26 } .-3 } template decltype (X + Y) f2 () { throw 1; } // { dg-error "arithmetic between different enumeration types 'A' and 'B'" "" { target c++26 } .-1 } // { dg-error "arithmetic between enumeration type 'A' and floating-point type 'double'" "" { target c++26 } .-2 } // { dg-error "arithmetic between floating-point type 'double' and enumeration type 'A'" "" { target c++26 } .-3 } template decltype (X | Y) f3 () { throw 1; } // { dg-error "bitwise operation between different enumeration types 'A' and 'B'" "" { target c++26 } .-1 } template decltype (X < Y) f4 () { throw 1; } // { dg-error "comparison between 'enum A' and 'enum B'" "" { target c++26 } .-1 } // { dg-error "comparison of enumeration type 'A' with floating-point type 'double'" "" { target c++26 } .-2 } // { dg-error "comparison of floating-point type 'double' with enumeration type 'A'" "" { target c++26 } .-3 } int main () { f1 (); f2 (); f3 (); f4 (); f1 (); // { dg-error "no matching function for call to" "" { target c++26 } } f2 (); // { dg-error "no matching function for call to" "" { target c++26 } } f3 (); // { dg-error "no matching function for call to" "" { target c++26 } } f4 (); // { dg-error "no matching function for call to" "" { target c++26 } } f1 (); // { dg-error "no matching function for call to" "" { target c++26 } } f2 (); // { dg-error "no matching function for call to" "" { target c++26 } } f4 (); // { dg-error "no matching function for call to" "" { target c++26 } } f1<0.0, a> (); // { dg-error "no matching function for call to" "" { target c++26 } } f2<0.0, a> (); // { dg-error "no matching function for call to" "" { target c++26 } } f4<0.0, a> (); // { dg-error "no matching function for call to" "" { target c++26 } } }