https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93805

            Bug ID: 93805
           Summary: [8/9/10 Regression] A suspicious -Werror=noexcept
                    warning since r8-2461-g9fb82e652cee118b
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Since the revision I see quite a suspicious warning:

$ cat rast.ii
template <class T> class A {
public:
  int m_fn1(T);
};
struct B {
  B() {}
};
class C {
  struct D {
    B extents = B();
  };
  A<D> reflection_probe_owner;
  int m_fn2();
};
int C::m_fn2() { return reflection_probe_owner.m_fn1(D()); }

$ g++ rast.ii -c -Werror=noexcept
rast.ii: In member function ‘int C::m_fn2()’:
rast.ii:15:56: error: noexcept-expression evaluates to ‘false’ because of a
call to ‘B::B()’ [-Werror=noexcept]
   15 | int C::m_fn2() { return reflection_probe_owner.m_fn1(D()); }
      |                                                        ^
rast.ii:6:3: error: but ‘B::B()’ does not throw; perhaps it should be declared
‘noexcept’ [-Werror=noexcept]
    6 |   B() {}
      |   ^
cc1plus: some warnings being treated as errors

Reply via email to