[Bug c++/66256] noexcept evaluation done before end of class

mmehlich at semanticdesigns dot com gcc-bugzilla@gcc.gnu.org
Sat Apr 23 16:49:00 GMT 2016


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

Michael Mehlich <mmehlich at semanticdesigns dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmehlich at semanticdesigns dot co
                   |                            |m

--- Comment #1 from Michael Mehlich <mmehlich at semanticdesigns dot com> ---
I agree, name resolution should consider all declarations in the class,
but apparently gcc does name resolution on the exception specification way too
early.

An example where this causes no error message being created for obviously wrong
code is the swap function in the pair template in the header file
bits/stl_pair.h (for gcc 5.3.0/cygwin), which is declared as
      void
      swap(pair& __p)
      noexcept(noexcept(swap(first, __p.first))
               && noexcept(swap(second, __p.second)))

clang 3.7.1. properly reports an error for the swap in the exception
specification.
BTW: The header file could be fixed easily by adding std:: in front of these
swap occurrences.


More information about the Gcc-bugs mailing list