mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
libstdc++: Fix use of feature test macro in <source_location>
libstdc++-v3/ChangeLog: * include/std/source_location: Check __glibcxx_contracts instead of __cpp_lib_contracts. * testsuite/18_support/contracts/includes.cc: New test.
This commit is contained in:
committed by
Jonathan Wakely
parent
4e47e85dd8
commit
a111fd4d47
@@ -38,12 +38,9 @@
|
||||
namespace std
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
#ifdef __cpp_lib_contracts
|
||||
namespace contracts
|
||||
{
|
||||
class contract_violation;
|
||||
}
|
||||
#endif // __cpp_lib_contracts
|
||||
#ifdef __glibcxx_contracts
|
||||
namespace contracts { class contract_violation; }
|
||||
#endif
|
||||
|
||||
/// A class that describes a location in source code.
|
||||
struct source_location
|
||||
@@ -95,10 +92,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
constexpr source_location (const void *__t)
|
||||
: _M_impl (static_cast <const __impl*>(__t)) {}
|
||||
|
||||
#ifdef __cpp_lib_contracts
|
||||
#ifdef __glibcxx_contracts
|
||||
/* To enable use of the source __impl*. */
|
||||
friend class std::contracts::contract_violation;
|
||||
#endif // __cpp_lib_contracts
|
||||
#endif
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
|
||||
6
libstdc++-v3/testsuite/18_support/contracts/includes.cc
Normal file
6
libstdc++-v3/testsuite/18_support/contracts/includes.cc
Normal file
@@ -0,0 +1,6 @@
|
||||
// { dg-options "-fcontracts" }
|
||||
// { dg-do compile { target c++26 } }
|
||||
|
||||
// We should not get errors from including this before <contracts>:
|
||||
#include <source_location>
|
||||
#include <contracts>
|
||||
Reference in New Issue
Block a user