Bug 89345 - gcc9 <new> uses constexpr token, can you change to _GLIBCXX_CONSTEXPR ?
Summary: gcc9 <new> uses constexpr token, can you change to _GLIBCXX_CONSTEXPR ?
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-13 19:39 UTC by mib.bugzilla
Modified: 2019-02-13 22:21 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-02-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mib.bugzilla 2019-02-13 19:39:03 UTC
In the patch to add destroying_delete, (Implement P0722R3, destroying operator delete.) the constexpr token is used directly, can you modify this to use the macro e.g. _GLIBCXX_CONSTEXPR. For example, recently the clang compiler predefines __cpp_impl_destroying_delete and this causes the <new> header to fail compilation if compiling with option -std=c++98.  

This issue is discussed here, https://reviews.llvm.org/D55741

Thanks and regards
--Melanie Blower
(I work on the Intel C++ compiler)
Comment 1 Jonathan Wakely 2019-02-13 21:54:19 UTC
I already started fixing this after your update to the phabricator update pinged me an email. I'm just going to make it conditional on __cplusplus > 201703L.
Comment 2 Jonathan Wakely 2019-02-13 22:14:07 UTC
Done
Comment 3 Jonathan Wakely 2019-02-13 22:14:27 UTC
Author: redi
Date: Wed Feb 13 22:13:45 2019
New Revision: 268856

URL: https://gcc.gnu.org/viewcvs?rev=268856&root=gcc&view=rev
Log:
PR libstdc++/89345 Only define std::destroying_delete for C++2a

Clang defines the __cpp_impl_destroying_delete macro unconditionally, so
that the feature is supported whenever the library type is defined. This
is incompatible with the current definition in libstdc++ because we use
constexpr and inline variables, which will give an error for older -std
modes.

This patch defines the destroying_delete_t type and destroying_delete
variable independently of the __cpp_impl_destroying_delete macro, but
only for C++2a (because the names aren't reserved for previous
standards). The __cpp_lib_destroying_delete macro is only defined when
both the library type and compiler macro are defined (i.e. when the type
can actually be used as intended).

	PR libstdc++/89345
	* include/std/version [__cpp_impl_destroying_delete]
	(__cpp_lib_destroying_delete): Only define for C++2a and later.
	* libsupc++/new [__cpp_impl_destroying_delete]
	(__cpp_lib_destroying_delete): Likewise.
	(destroying_delete_t, destroying_delete): Likewise, but define even
	when __cpp_impl_destroying_delete is not defined.
	* testsuite/18_support/destroying_delete.cc: New test.

Added:
    trunk/libstdc++-v3/testsuite/18_support/destroying_delete.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/version
    trunk/libstdc++-v3/libsupc++/new
Comment 4 mib.bugzilla 2019-02-13 22:21:43 UTC
thank you!