Skip to content

Commit f7df288

Browse files
committed
fix MSVC C++20 module build error C2872, C2039, C2873 on 'literals'
Fixed the errors from Visual Studio 2022 version 17.13.5 Compiler Version 19.43.34809 that appeared when building "tomlplusplus_modules", saying: src\modules\tomlpp.cppm(22,21): error C2872: 'literals': ambiguous symbol src\modules\tomlpp.cppm(21,22): could be 'toml::literals' include\toml++\impl\parser.hpp(322,19): or 'toml::v3::literals' src\modules\tomlpp.cppm(22,31): error C2039: '""_toml': is not a member of 'toml::literals' src\modules\tomlpp.cppm(21,22): see declaration of 'toml::literals' src\modules\tomlpp.cppm(22,9): error C2873: '""_toml': symbol cannot be used in a using-declaration src\modules\tomlpp.cppm(23,21): error C2872: 'literals': ambiguous symbol src\modules\tomlpp.cppm(21,22): could be 'toml::literals' include\toml++\impl\parser.hpp(322,19): or 'toml::v3::literals' src\modules\tomlpp.cppm(23,31): error C2039: '""_tpath': is not a member of 'toml::literals' src\modules\tomlpp.cppm(21,22): see declaration of 'toml::literals' src\modules\tomlpp.cppm(23,9): error C2873: '""_tpath': symbol cannot be used in a using-declaration
1 parent fea1d90 commit f7df288

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/modules/tomlpp.cppm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
module;
77

8+
#define TOML_UNDEF_MACROS 0
89
#include <toml++/toml.hpp>
910

1011
export module tomlplusplus;
@@ -19,8 +20,8 @@ export namespace toml {
1920
* @brief The toml++ namespace toml::literals::
2021
*/
2122
inline namespace literals {
22-
using toml::literals::operator""_toml;
23-
using toml::literals::operator""_tpath;
23+
using TOML_NAMESPACE::literals::operator""_toml;
24+
using TOML_NAMESPACE::literals::operator""_tpath;
2425
}
2526

2627
using toml::array;

0 commit comments

Comments
 (0)