sol2: Compilation error after upgrading to VS2019 16.7

I just upgraded VS2019 from version 16.6, to 16.7, now this code causes sol to explode… 🤯

	sol::table metatable;
	metatable[sol::meta_function::new_index] = sol::as_function([](sol::table table, const char* name, sol::object object){});

1>...\sol\function_types_stateless.hpp(38,1): error C2653: 'traits_type': is not a class or namespace name

Using latest master commit of sol.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Seems like 16.7.2 update still doesn’t contain the fix from the preview… Can someone confirm?

I’m also seeing this, would be great to get a fix.

Workaround for those that want the code to compile but doesn’t want to edit sol2 source.

In Visual Studio installer, click modify on the Visual Studio 2019, go to “Individual Components”, search and download “MSVC v142 - VS 2019 C++ build tools (v14.26)” for your architecture, then in your projects properties go to Advanced and select “14.26.28801” in the “MSVC Toolset Version”.

It’ll use the working compiler version until the proper fix is released.

Still busted for me, yeah.

I’m doing a lot but this one’s on my radar still. I’m trying not to just say “well lol no more noexcept I guess xD!”.

But I just might have to…

Yes, this has been asserted before; it seems like we might “just” need to wait for 16.8 to go gold and then we can have our noexcept again.

I’m pissed off that I updated to 16.7 a couple hours before seeing this issue. Anyway… I found a workaround that might help other.

I’m using the single include file and got the error at: 1>sol2-develop\single\include\sol\sol.hpp(17459,1): error C2653: 'traits_type': is not a class or namespace name

As a workaround, I noticed that if I comment the conditional noexcept, the compilation works. Like this: static int real_call(lua_State* L) /*noexcept(traits_type::is_noexcept)*/ {

I know this is not ideal, but at least it allows me to keep working on my code while Microsoft doesn’t release an update (or I hit another problem)