[Bug c++/56191] New: Destructor affects noexcept detection

antoshkka at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Feb 3 14:26:00 GMT 2013


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

             Bug #: 56191
           Summary: Destructor affects noexcept detection
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: antoshkka@gmail.com


GCC 4.7.2 incorrectly detects noexcept specification in case of move
constructor.
Here is an example:

struct descriptor_owner_movable {
    descriptor_owner_movable(descriptor_owner_movable&& ) noexcept {}

    // Without destructor it compiles correctly
    ~descriptor_owner_movable() {}
};

descriptor_owner_movable&& declval() noexcept;

int main() {
    static_assert(
        noexcept(descriptor_owner_movable(declval()))
    , "But it is nothrow!");
    return 0;
}



More information about the Gcc-bugs mailing list