mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
Add Clang support
This commit is contained in:
@@ -12,7 +12,7 @@ import python ;
|
||||
import testing ;
|
||||
import ../../config/checks/config : requires ;
|
||||
|
||||
########## BEGIN of helpers to detect C++20 non-type template args support
|
||||
########## BEGIN of helpers to detect C++20 features support
|
||||
|
||||
actions mp_simple_run_action
|
||||
{
|
||||
@@ -31,17 +31,16 @@ rule mp-run-simple ( sources + : args * : input-files * : requirements * : targe
|
||||
mp-run-simple cxx20_nontype_template_args_detection.cpp : : : : compiler_supports_cxx20_nontype_template_args ;
|
||||
explicit compiler_supports_cxx20_nontype_template_args ;
|
||||
|
||||
########## END of helpers to detect C++20 non-type template args support
|
||||
mp-run-simple cxx20_clang_workaround_detection.cpp : : : : compiler_supports_cxx20_clang_workaround ;
|
||||
explicit compiler_supports_cxx20_clang_workaround ;
|
||||
|
||||
local REQUIRE_CXX20_NONTYPE_TEMPLATE_ARGS =
|
||||
[ check-target-builds ../core_name//compiler_supports_cxx20_nontype_template_args : : <build>no ]
|
||||
;
|
||||
########## END of helpers to detect C++20 features support
|
||||
|
||||
project
|
||||
: source-location .
|
||||
: requirements
|
||||
<define>BOOST_PFR_DETAIL_STRICT_RVALUE_TESTING=1
|
||||
[ check-target-builds ../core_name//compiler_supports_cxx20_nontype_template_args : : <build>no ]
|
||||
[ check-target-builds ../core_name//compiler_supports_cxx20_nontype_template_args : : [ check-target-builds ../core_name//compiler_supports_cxx20_clang_workaround : : <build>no ] ]
|
||||
;
|
||||
|
||||
|
||||
|
||||
32
test/core_name/cxx20_clang_workaround_detection.cpp
Normal file
32
test/core_name/cxx20_clang_workaround_detection.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2023 Bela Schaum, X-Ryl669, Denis Mikhailov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
// Initial implementation by Bela Schaum, https://github.com/schaumb
|
||||
// The way to make it union and UB free by X-Ryl669, https://github.com/X-Ryl669
|
||||
//
|
||||
|
||||
template <auto p>
|
||||
class X {};
|
||||
|
||||
template <class T>
|
||||
struct Store
|
||||
{
|
||||
T v;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
Store(T) -> Store<T>;
|
||||
|
||||
struct S
|
||||
{
|
||||
int m;
|
||||
} s;
|
||||
|
||||
X<Store{&s.m}> x4;
|
||||
|
||||
int main() {}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
namespace testing {
|
||||
|
||||
namespace {
|
||||
|
||||
struct nonconstexpr {
|
||||
nonconstexpr() {};
|
||||
};
|
||||
@@ -67,9 +65,6 @@ void test_names_as_array() {
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
} // namespace testing
|
||||
|
||||
int main() {
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
namespace testing {
|
||||
|
||||
namespace {
|
||||
|
||||
struct Aggregate {
|
||||
int _%ARG%;
|
||||
};
|
||||
@@ -35,8 +33,6 @@ void test_names_as_array() {
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
} // namespace testing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user