-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
196 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
test/core_name/compile-fail/fields_names_could_not_detect_compiler.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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 | ||
// | ||
|
||
#define BOOST_PFR_FUNCTION_SIGNATURE "" | ||
#include <boost/pfr/core_name.hpp> | ||
|
||
struct A { int field; }; | ||
|
||
int main() { | ||
(void)boost::pfr::get_name<0, A>(); // Must be a compile time error | ||
} | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
test/core_name/compile-fail/fields_names_misconfigured_compiler.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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 | ||
// | ||
|
||
#define BOOST_PFR_FUNCTION_SIGNATURE "dummy" | ||
#define BOOST_PFR_CORE_NAME_PARSING (0,0,"") | ||
#include <boost/pfr/core_name.hpp> | ||
|
||
struct A { int field; }; | ||
|
||
int main() { | ||
(void)boost::pfr::get_name<0, A>(); // Must be a compile time error | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// 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 | ||
// | ||
|
||
#include <iostream> | ||
|
||
// This cpp file: | ||
// * tests BOOST_PFR_CORE_NAME_PARSING macro | ||
// * outputs full name of the function so that PFRs extraction of field name could be adjust to new compiler without requesting regression tester's help | ||
#define BOOST_PFR_CORE_NAME_PARSING (0,0,false,"") | ||
#include <boost/pfr/core_name.hpp> | ||
|
||
namespace user_defined_namespace { | ||
struct user_defined_class { int user_defined_field; }; | ||
} | ||
|
||
int main() | ||
{ | ||
using namespace boost::pfr; | ||
|
||
std::cout << "user_defined_namespace::user_defined_class::user_defined_field: " | ||
<< get_name<0, user_defined_namespace::user_defined_class>() << '\n'; | ||
|
||
|
||
return 0; | ||
} | ||
|