compiler bugs, will they ever stop harassing me?

ix.io/3pji/cpp

aka another reason to never use built-in arithmetic types.

@namark Are you sure it is a compiler bug? I am not sure whenever it actually is one or not tbf

@Archivist are you a gcc alt? stop gaslighting meeee >.<

otherwise, please elaborate, good sir, what is your objection? o.O

@Archivist don't make me read the standard, I'll defect report :<

@namark

The basis for my questioning here is that primitive operators in C++ are not functions, so whenever they warrant implicit conversions or not with a behaviour similar to an actual function is questionable

I will actually investigate that a bit and tell you my findings

@namark

I confirm that this is a bug of GCC linked to templates. You can circumvent that bug using concepts in a portable fashions (see here: godbolt.org/z/PzT9eeTj4)

@Archivist concepts are nice... the ranges and modules baggage though... also not going to use a standard that's barely not even done implemented yet so far.

The real workaround is

template<typename T, size_t D>
int operator+(int, One<T,D>);

and so on, and if that's all you needed maybe making the conversion explicit, not that gcc respects explicit
gcc.gnu.org/bugzilla/show_bug.
gcc.gnu.org/bugzilla/show_bug.
gcc.gnu.org/bugzilla/show_bug.

Follow

@Archivist *cough* I mean
template<typename T>
T operator+(T, One<T,1>);
and so on

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.