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



             Bug #: 56071

           Summary: noexcept with template and private ctor fails

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: steve...@gmail.com





$ g++ --version

g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2





The following code is accepted by clang++, but not g++:





class B

{

  template <typename T> friend struct A;

private:

    B() {}

    ~B() {}

};



template <typename T>

struct A

{

    T t;

    B b;

    A() noexcept(noexcept(B())) {}

};



#define BREAK



struct C {

  A<int> delegate;

  C()

#ifdef BREAK

      noexcept(noexcept(A<int>()))

#endif

    { }

};



int main() {return 0;}





If the #define BREAK is commented out, it is accepted by g++ too. Making A not

a template type also makes g++ accept it.

Reply via email to