http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869

             Bug #: 52869
           Summary: "this" not being allowed in noexcept clauses
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: d...@boostpro.com


Given the following, GCC says: "error: invalid use of 'this' at top level"
However, according to [expr.prim.general]/3 'this'
should be valid in the exception-specification as it comes after the
member function's optional cv-qualifier-seq.

  #define RETURNS(...) noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__)
 { return (__VA_ARGS__); } 

  struct mul_ {
      int operator()() const { return 1; }

      template <typename A>
      A operator()(A const & a) const noexcept(A(std::move(a))) { return a; }

      template <typename A, typename B, typename... C>
      auto operator()(A const & a, B const & b, C const &... c) const
          RETURNS((*this)(a * b, c...))
  };

Reply via email to