C++ Logo


Advanced search

UDL operators and space?

From: Matthew Woehlke <mwoehlke.floss_at_[hidden]>
Date: Mon, 17 Jun 2019 14:25:02 -0400
I recently hunted down a "bug" in the following code, which does not
compile on GCC 4.8.x:

  constexpr size_t operator ""_z(unsigned long long x)
    return static_cast<size_t>(x);

(BTW, will be nice when I don't need the UDL!)

GCC 4.8.x rejects the code because "error: missing space between ‘""’
and suffix identifier", which seems like an asinine restriction.
Apparently the committee agreed, because only GCC 4.8.x and clang 3.1
require that space; anything later just accepts it.

This is really just a curiosity question, since I couldn't find an
obvious answer online... does anyone know *when* and how this
restriction was lifted? (In particular, is it a change from C++11 to
C++14 that compilers just silently support even in -std=c++11 mode? Or
was it fixed as a defect / shortly before C++11 was final, and those
compilers just missed the boat?)


Received on 2019-06-17 13:26:53