C++ Logo

std-discussion

Advanced search

Re: UDL operators and space?

From: Peter C++ <peter.cpp_at_[hidden]>
Date: Mon, 17 Jun 2019 21:09:29 +0200
If I remember correctly that was lifted for C++14.

sent from a mobile device so please excuse strange words due to autocorrection.
Prof. Peter Sommerlad
peter.Sommerlad_at_[hidden]
+41-79-432 23 32

> On 17 Jun 2019, at 20:25, Matthew Woehlke via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> 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?)
>
> --
> Matthew
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-discussion

Received on 2019-06-17 14:11:21