Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tomplusplus fails to compile with msvc 2017 #55

Closed
sobczyk opened this issue Aug 26, 2020 · 5 comments
Closed

tomplusplus fails to compile with msvc 2017 #55

sobczyk opened this issue Aug 26, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@sobczyk
Copy link

sobczyk commented Aug 26, 2020

Environment

Compiler:
MSVC2017

C++ standard mode (e.g. 17, 20, 'latest'):
c++17

Target arch (e.g. x64):
x64

Library configuration overrides:

Relevant compilation flags:
/permissive-

Describe the bug

bug 1

__has_cpp_attribute is a c++20 feature
in toml_preprocessor.h there is no check for this

bug 2

cast operators in array_iterator and table_iterator are not liked by msvc, because of [[nodiscard]]

template <bool C = IsConst, typename = std::enable_if_t<!C>>
[[nodiscard]]
array_iterator<true>() const noexcept
{
    return array_iterator<true>{ raw_ };
}

see https://godbolt.org/z/Kvdrd3
the problem is fixed in 19.20 (_MSC_VER >= 1920)

@sobczyk sobczyk added the bug Something isn't working label Aug 26, 2020
@marzer
Copy link
Owner

marzer commented Aug 26, 2020

I'm not sure I consider this a bug, to be honest. VS2017's support for C++17 was something of a broken mess.

Having said that, I guess these are pretty easy to work around. Thanks for letting me know.

@marzer marzer closed this as completed in 6b91dda Aug 26, 2020
@sobczyk
Copy link
Author

sobczyk commented Aug 26, 2020

I've hit another bug...

1>  tomlplusplus\include\toml++\toml_table.h(126): error C3615: constexpr function 'toml::v2::impl::operator !=' cannot result in a constant expression
1>  tomlplusplus\include\toml++\toml_table.h(128): note: failure was caused by call of undefined function or one not declared 'constexpr'
1>  tomlplusplus\include\toml++\toml_table.h(128): note: see usage of 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<_Ty>>>::operator !='

and there's a clang-cl bug with detecting exceptions
clang-cl uses _CPPUNWIND and does not set __EXCEPTIONS

@sobczyk
Copy link
Author

sobczyk commented Aug 26, 2020

I know 2017 might not be a priority, but it's the last version with Express available (free enterprise use)

@marzer
Copy link
Owner

marzer commented Aug 26, 2020

I've hit another bug... (constexpr stuff)

Ah, that's easy fixed. It doesn't really make sense for that code to be marked constexpr anyway since toml++ objects aren't constexpr. Force of habit I guess.

clang-cl uses _CPPUNWIND and does not set __EXCEPTIONS

Yeh. I should probably simplify the way that's done anyway, since doing it per-compiler is not overly robust (since compilers all like to pretend to be each other anyways).

I know 2017 might not be a priority, but it's the last version with Express available (free enterprise use)

Be that as it may, I'm not going to jump through too many hoops to support it. I'm happy to make basic fixes like this, but consider VS2017 generally unsupported if much larger changes need to be made.

marzer added a commit that referenced this issue Aug 26, 2020
@marzer
Copy link
Owner

marzer commented Aug 26, 2020

@sobczyk I've just pushed fixes for the additional issues you ran into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants