Suppress modernize-use-equals-default

Clang-tidy emits this warning:

    src/cxx.cc:338:3: warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]
      MaybeUninit() {}
      ^             ~~
                    = default;
    src/cxx.cc:339:3: warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
      ~MaybeUninit() {}
      ^              ~~
                     = default;

but following the suggestion makes the code not compile (the default
implementation of the default constructor "is implicitly deleted because
the default definition would be ill-formed").

    src/cxx.cc: In function ‘std::string* cxxbridge1$std$shared_ptr$string$uninit(std::shared_ptr<std::__cxx11::basic_string<char> >*)’:
    src/cxx.cc:465:48: error: use of deleted function ‘rust::cxxbridge1::{anonymous}::MaybeUninit<T>::MaybeUninit() [with T = std::__cxx11::basic_string<char>]’
      465 |         reinterpret_cast<CXX_TYPE *>(new rust::MaybeUninit<CXX_TYPE>);         \
          |                                                ^~~~~~~~~~~~~~~~~~~~~
    src/cxx.cc:512:3: note: in expansion of macro ‘SHARED_PTR_OPS’
      512 |   MACRO(string, std::string)
          |   ^~~~~
    src/cxx.cc:517:1: note: in expansion of macro ‘FOR_EACH_SHARED_PTR’
      517 | FOR_EACH_SHARED_PTR(SHARED_PTR_OPS)
          | ^~~~~~~~~~~~~~~~~~~
    src/cxx.cc:338:3: note: ‘rust::cxxbridge1::{anonymous}::MaybeUninit<T>::MaybeUninit() [with T = std::__cxx11::basic_string<char>]’ is implicitly deleted because the default definition would be ill-formed:
      338 |   MaybeUninit() = default;
          |   ^~~~~~~~~~~
    src/cxx.cc:337:5: error: union member ‘rust::cxxbridge1::{anonymous}::MaybeUninit<std::__cxx11::basic_string<char> >::value’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
      337 |   T value;
          |     ^~~~~
This commit is contained in:
David Tolnay 2020-12-10 19:54:11 -08:00
parent 5b16340b67
commit f72b0c6182
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -14,5 +14,6 @@ Checks:
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-special-member-functions,
-modernize-use-default-member-init,
-modernize-use-equals-default,
-modernize-use-trailing-return-type,
HeaderFilterRegex: cxx\.h