C3409:noreturn不允许空属性块

时间:2015-09-28 03:11:45

标签: c++ visual-studio-2013 noreturn

我在VS2013中从C3409: empty attribute block is not allowed收到一个错误noreturn

以下是代码段:

#ifndef CPPX_NORETURN
#   define  CPPX_NORETURN [[noreturn]]
#endif

...

namespace std {
    class nested_exception
    {
    private:
        exception_ptr nested;

    public:
        CPPX_NORETURN      // error is here
             void rethrow_nested() const
        {
            rethrow_exception(nested);
        }

有人可以帮我弄清楚如何修复此错误吗?提前谢谢。

1 个答案:

答案 0 :(得分:1)

VS2013不支持C ++ 11属性功能(VS2015支持它)。

http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx

您可以使用__declspec(noreturn)代替[[noreturn]]

https://msdn.microsoft.com/en-us/library/vstudio/k6ktzx3s%28v=vs.100%29.aspx