[llvm-bugs] [Bug 25265] New: Clang-cl error on missing exception specification 'throw()'

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 20 10:53:17 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25265

            Bug ID: 25265
           Summary: Clang-cl error on missing exception specification
                    'throw()'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: drivehappy at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Clang-cl will produce an error when a definition doesn't match the declaration
containing a 'throw()'. I believe this is correct behavior, however MSVC will
silently ignore this and compile. This was originally seen attempting to pull
in the atltime.h header, but can be reproduced with the following:

class Foo {
    int Bar() const throw();
};

int Foo::Bar() const {
    return 0;
}


1>Source.cpp(7,10): error : 'Bar' is missing exception specification 'throw()'



I expect clang-cl with the -fms-extensions option should allow this to compile
with a warning, as it's very difficult to change the ATL headers.


Note: Flipping the throw specification to the definition seems to produce an
expected warning:

class Foo {
    int Bar() const ;
};

int Foo::Bar() const throw() {
    return 0;
}


1>Source.cpp(7,10): warning : exception specification in declaration does not
match previous declaration [-Wmicrosoft-exception-spec]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151020/c85e2144/attachment.html>


More information about the llvm-bugs mailing list