[Bug c++/56071] New: noexcept with template and private ctor fails

steveire at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jan 21 22:10:00 GMT 2013


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: unassigned@gcc.gnu.org
        ReportedBy: steveire@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.



More information about the Gcc-bugs mailing list