[llvm-bugs] [Bug 39361] New: Overload resolution depends on declaration order with -fms-compatibility
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 19 18:46:03 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39361
Bug ID: 39361
Summary: Overload resolution depends on declaration order with
-fms-compatibility
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid, compile-fail, miscompilation
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: hstong at ca.ibm.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Overload resolution with -fms-compatibility seems to be dependent on the order
of declarations. The overload sets f and g are parallels of each other, but
parallel calls do not resolve the same.
### SOURCE (<stdin>):
char *f(float, int);
template <typename T> int f(long, T);
template <typename T> int g(long, T);
char *g(float, int);
bool zip(int x) { return f(x, x) == g(x, x); }
### COMPILER INVOCATION COMMAND:
clang++ -cc1 -triple i386-unknown-linux-gnu -fsyntax-only -x c++ -std=c++03
-fms-compatibility -
### ACTUAL COMPILER OUTPUT:
<stdin>:6:34: error: comparison between pointer and integer ('char *' and
'int')
bool zip(int x) { return f(x, x) == g(x, x); }
~~~~~~~ ^ ~~~~~~~
1 error generated.
### EXPECTED COMPILER OUTPUT:
(Clean compile).
### COMPILER VERSION INFO (clang++ -v):
clang version 8.0.0 (https://github.com/llvm-mirror/clang.git
2abe10f0902311fdb2896d3c6223787f51049fac)
(https://github.com/llvm-mirror/llvm.git
4aeb7d033aef4e4345e52330160ea21ade905859)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
--
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/20181020/9c03ff44/attachment.html>
More information about the llvm-bugs
mailing list