[LLVMbugs] [Bug 23811] New: Overload resolution works when function reference type is used as lhs of assignment but not a cast-expression
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jun 10 12:52:55 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23811
Bug ID: 23811
Summary: Overload resolution works when function reference type
is used as lhs of assignment but not a cast-expression
Product: clang
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: andrey.vul at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The following code tests [over.over]/1.2 and [over.over]/1.6.
Clang resolves the address of the overloaded function in the first case but not
the second case.
SOURCE: cat /tmp/a.cc
template <class T> T f(T x) {
return x + 1;
}
int main() {
typedef int (&&fp1)(int);
fp1&& p10 = f; // ok
fp1&& p11 = static_cast<fp1&&>(f); // fail
}
INVOCATION: clang++ -std=c++11 -v
clang version 3.6.1 (tags/RELEASE_361/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2
"/usr/bin/x86_64-pc-linux-gnu-clang-3.6.1" -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name a.cc
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.25 -v -dwarf-column-info
-resource-dir /usr/bin/../lib/clang/3.6.1 -internal-isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4 -internal-isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4/x86_64-pc-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.6.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 150
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/a-810097.o -x c++ a.cc
clang -cc1 version 3.6.1 based upon LLVM 3.6.1 default target
x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4/x86_64-pc-linux-gnu
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4/backward
/usr/bin/../lib/clang/3.6.1/include
/usr/include
End of search list.
a.cc:8:14: error: address of overloaded function 'f' cannot be static_cast to
type 'fp1 &&'
fp1&& p11 = static_cast<fp1&&>(f);
^~~~~~~~~~~~~~~~~~~~~
a.cc:1:22: note: candidate function
template <class T> T f(T x) {
^
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/20150610/c215b1d9/attachment.html>
More information about the llvm-bugs
mailing list