[PATCH] D48753: [libcxx] Use custom allocator's `construct` in C++03 when available.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 6 14:45:17 PDT 2018

vsapsai added inline comments.

Comment at: libcxx/include/memory:1470
+        decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Pointer>(),
+                                                    _VSTD::declval<_Args>())),
+        void
Quuxplusone wrote:
> I think you should replace this `)))` with `)), void())` for absolute correctness (e.g. `construct` might plausibly return a pointer to the constructed object, and I think C++03 is okay with that).
> Otherwise, awesome, this looks like what I'd expect. :)
The standard says the result of `construct` is not used but I haven't found any mention it **must** be `void`.

That being said, the proposed change fails for the C++03 macro-based decltype shim:

    error: too many arguments provided to function-like macro invocation
                                        _VSTD::declval<_Args>()), void()),

One option to fix that is to use


But I don't think this use case is worth such hacks.


More information about the cfe-commits mailing list