https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83049
Bug ID: 83049 Summary: Allow overloading of ?: conditional operator Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bugzi...@poradnik-webmastera.com Target Milestone: --- C++ standard states than conditional operator ?: cannot be overloaded. However things changed since this rule was created, and now there are reasons to do this - in fact gcc provided overloaded version of this operator for vector extensions. Ability to overload it may be useful in user code too. One example: in the past I crested small library which was wrapping various SIMD instructions (SSE, AVX, NEON, and scalars as a pseudo-vector with 1 element). It provided types and defines like this: template <typename SIMDTraits> class SIMDVector; struct SSEDoubleTraits; #ifdef __SSE2__ typedef SIMDVector<SSEDoubleTraits> DoubleVector; #define HAS_DOUBLE_VECTOR_2 1 #define DOUBLE_VECTOR_SIZE 2 #endif With code like above, I was able to abstract out all SIMD stuff and use DoubleVector in code which performed actual calculations. Ability to overload ?: operator in SIMDVector<> would be helpful and make code more natural.