When I use clang ( version 3.4 (trunk 194574) ) to compile this:
typedef void (* FunctionThatNeverReturns [[ noreturn ]])();
I get this:
error: 'noreturn' attribute only applies to functions and methods
This surprises me because it did a great job with the old version of clang.
So how can I define a pointer to the [[ noreturn ]] function?
I need this because I call the function pointer inside the [[ noreturn ]] function, which explicitly gives a warning if the function pointer is not marked as noreturn.
Oh and it works:
typedef void (* FunctionThatNeverReturns [[ gnu::noreturn ]])();
But is there a compiler-independent solution?
source share