C++ Logo

std-discussion

Advanced search

Re: UDL operators and space?

From: Daniel Krügler <daniel.kruegler_at_[hidden]>
Date: Mon, 17 Jun 2019 21:14:31 +0200
Am Mo., 17. Juni 2019 um 20:25 Uhr schrieb Matthew Woehlke via
Std-Discussion <std-discussion_at_[hidden]>:
>
> 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?)

The corresponding CWG issue was

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1473

It was fixed before C++14, but after C++11 was released, see the
definition of a CD3 issue:

"A DR/DRWP or Accepted/WP issue not resolved in C++11 but included in
the Committee Draft advanceed for balloting at the April, 2013 WG21
meeting."

- Daniel

Received on 2019-06-17 14:16:32