[llvm-bugs] [Bug 37853] New: Clang-CL fails with mismatching exception spec with /std:c++latest

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 19 04:36:15 PDT 2018


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

            Bug ID: 37853
           Summary: Clang-CL fails with mismatching exception spec with
                    /std:c++latest
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

$ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe /c "../simplemain.cpp"
simplemain.cpp

$ CL.exe /c /std:c++latest "../simplemain.cpp"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

simplemain.cpp

$ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe /c /std:c++latest
"../simplemain.cpp"
simplemain.cpp
../simplemain.cpp(6,5):  warning: exception specification in declaration does
not match previous declaration [-Wmicrosoft-exception-spec]
int foo(int) throw();
    ^
../simplemain.cpp(4,5):  note: previous declaration is here
int foo(int);
    ^
../simplemain.cpp(6,5):  error: conflicting types for 'foo'
int foo(int) throw();
    ^
../simplemain.cpp(4,5):  note: previous declaration is here
int foo(int);
    ^
1 warning and 1 error generated.

$ type ..\simplemain.cpp



int foo(int);

int foo(int) throw();



This occurred in real code where _HAS_EXCEPTIONS was forcibly set to 0:

$ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe /c /std:c++latest
"../simplemain.cpp"
simplemain.cpp
In file included from ../simplemain.cpp:5:
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\new.h(31,42): 
error: conflicting types for
      'set_new_handler'
            _CRTIMP2 new_handler __cdecl set_new_handler(_In_opt_ new_handler
_NewHandler) throw();
                                         ^
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\new(26,30): 
note: previous declaration is here

_CRTIMP2 new_handler __cdecl set_new_handler(_In_opt_ new_handler)
                             ^
1 error generated.

$ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe /c "../simplemain.cpp"
simplemain.cpp

$ CL.exe /c /std:c++latest "../simplemain.cpp"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

simplemain.cpp

$ type ..\simplemain.cpp

#define _HAS_EXCEPTIONS 0

#include <new>
#include <new.h>

-- 
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/20180619/79f9d9d4/attachment-0001.html>


More information about the llvm-bugs mailing list