Skip to content

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

@carlosgalvezp

Description

@carlosgalvezp

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions