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

            Bug ID: 66684
           Summary: [6 Regression] ICE in merge_exception_specifiers, at
                    cp/typeck2.c:2114
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

I'm seeing an ICE on trunk when a function is redeclared with a different
exception spec:


template<typename T>
struct traits
{
  static constexpr bool foo() { return sizeof(T) > 1; }
  static constexpr bool bar() { return sizeof(T) > 1; }
};

template<typename T>
struct X
{
  X& operator=(X&&) noexcept(traits<T>::foo());
};

template<typename T>
  X<T>&
  X<T>::operator=(X&&) noexcept(traits<T>::foo() && traits<T>::bar())
  { return *this; }


5.1.1 correctly rejects this:

ice.cc:16:69: error: declaration of ‘X<T>& X<T>::operator=(X<T>&&) noexcept
((traits<T>::foo() && traits<T>::bar()))’ has a different exception specifier
   X<T>::operator=(X&&) noexcept(traits<T>::foo() && traits<T>::bar())
                                                                     ^
ice.cc:11:6: error: from previous declaration ‘X<T>& X<T>::operator=(X<T>&&)
noexcept (traits<T>::foo())’
   X& operator=(X&&) noexcept(traits<T>::foo());
      ^

Reply via email to