[LLVMbugs] [Bug 8800] New: conversion function not viable if conversion-type-id is reference to incomplete type
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Dec 17 03:15:11 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=8800
Summary: conversion function not viable if conversion-type-id
is reference to incomplete type
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: zilla at kayari.org
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
$ clang++ -v
clang version 2.9 (trunk 121966)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$
$ cat conv.cc
struct A;
struct C {
operator A&();
};
int main()
{
C c;
A& a1(c);
A& a2 = c;
A& a3 = static_cast<A&>(c);
A& a4 = (A&)c;
}
$
$ clang++ conv.cc
conv.cc:10:8: error: no viable conversion from 'C' to 'A'
A& a1(c);
^ ~
conv.cc:4:5: note: candidate function
operator A&();
^
conv.cc:11:8: error: no viable conversion from 'C' to 'A'
A& a2 = c;
^ ~
conv.cc:4:5: note: candidate function
operator A&();
^
conv.cc:12:13: error: no viable conversion from 'C' to 'A'
A& a3 = static_cast<A&>(c);
^ ~
conv.cc:4:5: note: candidate function
operator A&();
^
3 errors generated.
All four initializations should use the same conversion but only the fourth one
works. Conversion to A* works fine, but not A&
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list