1// PR c++/65985 2// { dg-do compile { target c++14 } } 3 4#include <cassert> 5 6class Angle 7{ 8 int degrees = 0; 9 10 constexpr auto invariant() const noexcept 11 { 12 return 0 <= degrees && degrees < 360; 13 } 14 15public: 16 explicit constexpr Angle(int n) noexcept 17 : degrees{n % 360} 18 { 19 assert(invariant()); 20 } 21 22 /* implicit */ constexpr operator auto() const noexcept 23 { 24 return degrees; 25 } 26}; 27 28int main() 29{ 30 static_assert(Angle{360} == 0, ""); 31} 32