Skip to content

address bugprone-exception-escape clang-tidy warning in Macro copy constructor #537

@firewave

Description

@firewave

Encountered in #421.

/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_pair.h:295:17: error: an exception may be thrown in function 'pair' which should not throw exceptions [bugprone-exception-escape,-warnings-as-errors]
  295 |       constexpr pair(pair&&) = default;         ///< Move constructor
      |                 ^
/home/runner/work/simplecpp/simplecpp/simplecpp.cpp:1747:29: note: frame #0: unhandled exception of type 'simplecpp::Macro::Error' may be thrown in function 'parseDefine' here
 1747 |                             throw Error(tok->location, "In definition of '" + nameTokDef->str() + "': Missing opening parenthesis for __VA_OPT__");
      |                             ^
/home/runner/work/simplecpp/simplecpp/simplecpp.cpp:1508:21: note: frame #1: function 'operator=' calls function 'parseDefine' here
 1508 |                     parseDefine(other.nameTokDef);
      |                     ^
/home/runner/work/simplecpp/simplecpp/simplecpp.cpp:1495:19: note: frame #2: function 'Macro' calls function 'operator=' here
 1495 |             *this = other;
      |                   ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_pair.h:295:17: note: frame #3: function 'pair' calls function 'Macro' here
  295 |       constexpr pair(pair&&) = default;         ///< Move constructor
      |                 ^
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions