llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.69k stars 11.87k forks source link

A [[nonblocking]] destructor can trigger a bogus "missing exception specification" warning #111726

Open dougsonos opened 2 weeks ago

dougsonos commented 2 weeks ago
class Foo {
public:
    Foo();

    void bar() [[clang::nonblocking]];

    ~Foo() [[clang::nonblocking]];
};

void Foo::bar() // no diagnostic
{
}

Foo::~Foo() // error: '~Foo' is missing exception specification 'noexcept'
{
}

Seems to come from Sema::CheckEquivalentExceptionSpec. Something about the function effect being part of the type triggers this.

It's easily worked around by copying the attribute to the destructor's definition.

I can look at this; please assign to me.

shafik commented 2 weeks ago

CC @erichkeane