This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66684] New: [6 Regression] ICE in merge_exception_specifiers, at cp/typeck2.c:2114


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());
      ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]