Noexcept and Visual Studio 2012


#1

Hi,

I’m running into a similar problem as discussed in this thread: http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=9053&hilit=noexcept
So I added this code to have noexcept defined in juce_PlatformDefs.h

#if defined (_MSC_VER) && _MSC_VER >= 1600 #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 0

Now this macro should be executed:

#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_NOEXCEPT) #ifdef noexcept #undef noexcept #endif #define noexcept throw() #if defined (_MSC_VER) && _MSC_VER > 1600 #define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining) #endif #endif

Oddly I now get this errors:

If I comment out the “#define _ALLOW_KEYWORD_MACROS” and I get errors about redefining a keyword. So it actually executes the macro but it doesn’t change anything.

Any advice on this?

Thanks in advance.

edit: I’m using juce 2.0.40


#2

I’ve been using VC2012 without any such problems. Why are you setting JUCE_COMPILER_SUPPORTS_NOEXCEPT=0 ? What problem does that solve?


#3

The new class wizard made this include for my new Thread subclass

which leads to the noexcept compile error. The same code but with a JuceHeader.h include compiles just fine.

Sorry for the inconvenience