-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!
Description
Repros with VS 2022 17.7 Preview 2 x64 containing Clang 16.0.1.
D:\GitHub\STL\out\x64>type meow.cpp
#include <cassert>
#include <functional>
using namespace std;
int main() {
const function<void()> f;
assert(f.target<void()>() == nullptr);
}D:\GitHub\STL\out\x64>cl /EHsc /nologo /W4 /MTd /Od meow.cpp && meow
meow.cpp
D:\GitHub\STL\out\x64>clang-cl /EHsc /nologo /W4 /MTd /Od meow.cpp && meow
In file included from meow.cpp:2:
D:\GitHub\STL\out\x64\out\inc\functional(1142,16): error: reinterpret_cast from 'const void *' to 'void (*)()' casts
away qualifiers
return reinterpret_cast<const _Fx*>(this->_Target(typeid(_Fx)));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
meow.cpp(8,14): note: in instantiation of function template specialization 'std::function<void ()>::target<void ()>'
requested here
assert(f.target<void()>() == nullptr);
^
1 error generated.
Reduced from the original report DevCom-10402530 VSO-1843867 AB#1843867 "std::function::target is broken on clang-cl when called on const objects".
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!