This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50871] New: [C++0x] G++ fails to reject explicitly-defaulted function definition with different exception spec


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]