CPPDebuggerVisualizers icon indicating copy to clipboard operation
CPPDebuggerVisualizers copied to clipboard

Contents of boost::optional<T> are not displayed properly if T is declared in anonymous namespace

Open mmatrosov opened this issue 9 years ago • 10 comments

Consider this code:

namespace
{
  enum class Side { Right, Left };
}

enum class Dir { Up, Down };

int main() 
{
  auto side = Side::Right;  // Displayed ok
  boost::optional<Dir> dirOpt = Dir::Up;  // Displayed ok
  boost::optional<Side> sideOpt = Side::Right;  // Displayed raw only
}

Variables side and dirOpt are displayed fine. But variable sideOpt is displayed as there was no natvis installed - raw content is shown only.

mmatrosov avatar Oct 19 '16 14:10 mmatrosov

Which VS and boost version?

KindDragon avatar Oct 19 '16 16:10 KindDragon

Visual Studio 2015 Update 4. boost 1.58.

mmatrosov avatar Oct 19 '16 19:10 mmatrosov

Probably it is Visual Studio error:

Error while evaluating '*((enum `anonymous namespace'::Side *)dummy_.data)' in the context of type 'BoostTest.VS2015.exe!boost::optional_detail::aligned_storage<enum `anonymous namespace'::Side>'.

*((enum 'anonymous namespace'::Side*)0) this also doesn't work

KindDragon avatar Oct 19 '16 23:10 KindDragon

Same issue with std::atomic

KindDragon avatar Oct 20 '16 00:10 KindDragon

Is it reported anywhere?

mmatrosov avatar Oct 20 '16 06:10 mmatrosov

IDK

KindDragon avatar Oct 20 '16 08:10 KindDragon

Could you please either report it, or tell me how did you get this error message?

mmatrosov avatar Oct 20 '16 14:10 mmatrosov

https://connect.microsoft.com/VisualStudio/feedback/details/3107485

KindDragon avatar Oct 20 '16 15:10 KindDragon

Thanks!

mmatrosov avatar Oct 20 '16 15:10 mmatrosov

https://developercommunity.visualstudio.com/idea/388773/support-anonymous-namespaces-in-the-debugger.html

KindDragon avatar Apr 27 '20 13:04 KindDragon