http://llvm.org/bugs/show_bug.cgi?id=6457

           Summary: Clang fails to model explicitly created temporaries
                    correctly
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


The summary is based on the discussion with John and Doug about the cause of a
rather mysterious diagnostic for entirely valid C++ code. Here is the test case

chandl...@osiris build % cat t.cc
template <typename T> struct X { explicit X(T* p = 0) { }; };
template <typename T> struct Y { Y(int, const T& x); };
struct A { };
template <typename T>
struct B {
  B() : y(0, X<A>()) { }
  Y<X<A> > y;
};
B<int> b;
chandl...@osiris build % ./bin/clang -fsyntax-only t.cc
t.cc:6:9: error: no matching constructor for initialization of 'Y<X<struct A>
>'
  B() : y(0, X<A>()) { }
        ^
t.cc:9:8: note: in instantiation of member function 'B<int>::B' requested here
B<int> b;
       ^
t.cc:2:34: note: candidate constructor not viable: no known conversion from
'struct A *' to 'struct X<struct A> const' for 2nd argument
template <typename T> struct Y { Y(int, const T& x); };
                                 ^
t.cc:2:30: note: candidate constructor (the implicit copy constructor) not
viable: requires 1 argument, but 2 were provided
template <typename T> struct Y { Y(int, const T& x); };
                             ^
4 diagnostics generated.


After some digging and discussion, the root cause of the problem is that we are
somehow no longer building CXXTemporaryObjectExpr objects to represent explict
calls to constructors, and instead are building a CXXConstructCall, which as
Doug said, should actually be called CXXImplicitConstructCall or some such. In
fact, we never construct CXXTemporaryObjectExprs any more, probably a bad sign.
;]

-- 
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