Entt: resource_cache move ctor

Created on 28 Apr 2019  ·  10Comments  ·  Source: skypjack/entt

Hey,

With the latest src of entt (master) I'm getting an error in resource/cache.hpp on line 39 related to the default move constructor that's defined there:

resource_cache(resource_cache &&) ENTT_NOEXCEPT = default;

`1>entt/resource/cache.hpp(39): error : exception specification of explicitly defaulted move constructor does not match the calculated one
1>./managers/texture_manager.hpp(47): note: in instantiation of template class 'entt::resource_cache<sf::Texture>' requested here`

This is the line in texture_manager.hpp:

using texture_cache = entt::resource_cache<sf::Texture>;
texture_cache textures;

The issue no longer appears when I comment out the move ctor but I'm sure that it's there for a reason?

I'm compilling my project on x64 with CLANG/LLVM.

bug

Most helpful comment

I think clang is right in this case. The exception specification from the std::unordered_map is incompatible with that of the cache actually.
Good point. :+1:

All 10 comments

Uhm... Have you exceptions turned on? Try to remove the ENTT_NOEXCEPT part only and let me know what happens, please.

Uhm... Have you exceptions turned on? Try to remove the ENTT_NOEXCEPT part only and let me know what happens, please.

Removed ENTT_NOEXCEPT and it compiles succesfully.

Seems to be related to CLANG, it compiles with ENTT_NOEXCEPT using MSVC (Visual Studio 2017 (v141) toolset)

What version of clang?

What version of clang?

Version 8.0.0
http://releases.llvm.org/8.0.0/tools/clang/docs/index.html

I think clang is right in this case. The exception specification from the std::unordered_map is incompatible with that of the cache actually.
Good point. :+1:

I think clang is right in this case. The exception specification from the std::unordered_map is incompatible with that of the cache actually.
Good point. 👍

Is that something that you can address by changing the code or should I just keep the NOEXCEPT commented out?

The problem is that the cache marks its move-c'tor as noexcept. Its a problem because it invokes the move-c'tor from std::unordered_map which is however _not_ marked noexcept. The compiler is complaining about this discrepancy (don't want to call a non-noexcept-marked, i.e. potentially throwing, function from a noexcept-marked one). Once the cache's move-c'tor is no longer noexcept the warning or error should go away, so just a small change to EnTT.

Yep, confirmed, a change to EnTT is required.
You've to wait until I'm back home, then I'll do it directly upstream.
I'm marking this as a bug to give it higher priority. :+1:

Great! No rush, I've adjusted it locally in the src for the time being.

Outlook voor Android downloadenhttps://aka.ms/ghei36


From: Michele Caini notifications@github.com
Sent: Monday, April 29, 2019 12:01:41 AM
To: skypjack/entt
Cc: NullBy7e; Author
Subject: Re: [skypjack/entt] resource_cache move ctor (#233)

Yep, confirmed, a change to EnTT is required.
You've to wait until I'm back home, then I'll do it directly upstream.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/skypjack/entt/issues/233#issuecomment-487419260, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AB7H4F643N3LFGG5EHDH243PSYNELANCNFSM4HI6IIOQ.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Deins picture Deins  ·  6Comments

seanballais picture seanballais  ·  6Comments

skypjack picture skypjack  ·  4Comments

bilek993 picture bilek993  ·  3Comments

bjadamson picture bjadamson  ·  4Comments