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

             Bug #: 50871
           Summary: [C++0x] G++ fails to reject explicitly-defaulted
                    function definition with different exception spec
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org


Preprocessed source, note first line:

# 1 "/" 3

class condvar
{
public:

  condvar() noexcept;
  ~condvar() noexcept;

};

condvar::condvar() = default;
condvar::~condvar() = default;


This should be rejected because the explicitily-defaulted definitions are
missing "noexcept" but it compiles without error:

$ g++ -std=gnu++0x  cv.ii -c
$


If the first line is removed it is rejected:

cv.ii:11:18: error: declaration of ‘condvar::condvar()’ has a different
exception specifier
cv.ii:6:3: error: from previous declaration ‘condvar::condvar() noexcept
(true)’
cv.ii:12:19: error: declaration of ‘condvar::~condvar()’ has a different
exception specifier
cv.ii:7:3: error: from previous declaration ‘condvar::~condvar() noexcept
(true)’

Reply via email to