[llvm-bugs] [Bug 30963] New: clang-cl does not match MSVC in converting string literal to void*
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 9 08:55:04 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=30963
Bug ID: 30963
Summary: clang-cl does not match MSVC in converting string
literal to void*
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: dmajor at mozilla.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The conversion from string literal to char* is accepted, with a warning, but
conversion to void* is rejected.
-------------------------------------------------
$ cat foo.cpp
void c(char* ptr) {}
void v(void* ptr) {}
int main()
{
c("hello");
v("world");
return 0;
}
-------------------------------------------------
$ cl foo.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
foo.cpp
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:foo.exe
foo.obj
-------------------------------------------------
$ clang-cl -fms-compatibility-version=19.00.24215.1 foo.cpp
foo.cpp(6,5): warning: ISO C++11 does not allow conversion from string literal
to 'char *'
[-Wwritable-strings]
c("hello");
^
foo.cpp(7,3): error: no matching function for call to 'v'
v("world");
^
foo.cpp(2,6): note: candidate function not viable: no known conversion from
'const char [6]' to 'void *' for 1st argument
void v(void* ptr) {}
^
1 warning and 1 error generated.
--
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/20161109/1f5ddc4f/attachment.html>
More information about the llvm-bugs
mailing list