llvm / llvm-project

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

False positive bugprone-throw-keyword-missing with NSDMI #115055

Open carlosgalvezp opened 1 day ago

carlosgalvezp commented 1 day ago

Example:

struct RegularException
{
    RegularException(int);
};

class Foo
{
 public:
    Foo(){} 

 private:
    RegularException x_{123};
};

Gives:

[source>:12:24: warning: suspicious exception object created but not thrown; did you mean 'throw RegularException'? [bugprone-throw-keyword-missing]](javascript:;)
   12 |     RegularException x_{123};
      |                        ^

Godbolt

llvmbot commented 1 day ago

@llvm/issue-subscribers-clang-tidy

Author: Carlos Galvez (carlosgalvezp)

Example: ```cpp struct RegularException { RegularException(int); }; class Foo { public: Foo(){} private: RegularException x_{123}; }; ``` [Godbolt](https://godbolt.org/z/47rsz97hf)