https://llvm.org/bugs/show_bug.cgi?id=27785

            Bug ID: 27785
           Summary: Clang doesn’t implement DR1579 for id-expressions in
                    return statements
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Given the following snippet:

#include <iostream>
#include <memory>

using namespace std;

struct Base 
{
};

struct Derived : public Base 
{ 
    void DoStuffSpecificToDerivedClass() 
    {
    } 
};

std::unique_ptr<Base> factoryMethod()
{
    auto derived = std::make_unique<Derived>();
    derived->DoStuffSpecificToDerivedClass();
    return derived;
}

Clang gives the error:
error: no viable conversion from returned value of type 'unique_ptr<Derived,
default_delete<Derived>>' to function return type 'unique_ptr<Base,
default_delete<Base>>'
return derived;
^~~~~~~

Both VS2015 and GCC 5.1 compile without any error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to