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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


$ 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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to