Opened 10 years ago
Closed 9 years ago
#7317 closed Bugs (fixed)
[type_traits] remove_const not working on vc11
Reported by: | Eric Niebler | Owned by: | John Maddock |
---|---|---|---|
Milestone: | To Be Determined | Component: | type_traits |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
One of proto's tests is currently failing on vc11 with the following error:
external_transforms.cpp C:\local\Regression\boost\boost/type_traits/remove_const.hpp(52) : error C2039: 'unqualified_type' : is not a member of 'boost::detail::cv_traits_imp<T>' with [ T=void (__cdecl *const *)(void) ] C:\local\Regression\boost\boost/type_traits/remove_const.hpp(73) : see reference to class template instantiation 'boost::detail::remove_const_impl<T>' being compiled with [ T=void (__cdecl *const )(void) ]
John, can you have a look? The proto test in question is external_transforms if you need a repro.
Attachments (1)
Change History (8)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
I don't have a copy of vc11 either. Could very well be a regression in the compiler. I suppose you could post a msg to the devel list and see if anybody is willing to try the fix for you. And once the compiler is publicly available, we can come up with a minimal repro and file a compiler bug. I'd think they'd want to fix this one if it's a regression that affects boost.
comment:3 by , 10 years ago
I downloaded the free version of msvc-11 and isolated the bug. It does appear to be a regression in the msvc compiler. I've reported it here:
I'll see if I can come up with a work-around. It'd be nice to get this fixed for 1.52.
comment:4 by , 10 years ago
I haven't added a test for this because it looks like you have a TT testing system that I haven't grokked. But here is a very simple test case that should expose the problem.
#include <boost/type_traits/remove_const.hpp> struct S { template<typename T> typename boost::remove_const<T>::type *operator=(T const &t) const { return 0; } }; void bar() {} int main() { S s; s = bar; }
With the patch, this compiles. Without it, it doesn't.
comment:5 by , 10 years ago
Oh wait. This introduces a couple of regressions I need to investigate. I'll get back to this.
comment:6 by , 10 years ago
OK, the attached patch seems to do the trick and doesn't introduce regressions as far as I can tell. I think that a better fix would be to simply defer to std::remove_const and friends. But then, that could be done for all traits that have compatible C++11 implementations. That seemed like a bigger change. I'll leave that up to you.
comment:7 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
A little late in the day, but patches tested and applied to develop.
Eric I'm not sure what I can do here: I don't have that compiler (and won't until they decide to release the desktop express edition), but more particularly it looks like a clear compiler bug. That code has been unchanged since the beginning of time and always worked well too. Do you have VC11? If so you could try adding a:
template <typename T> struct cv_traits_imp<T*const*> {
};
partial specialization to cv_traits_imp.hpp and see if that helps?