[llvm-bugs] [Bug 27785] New: Clang doesn’t implement DR1579 for id-expressions in return statements
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 17 00:15:33 PDT 2016
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: unassignedbugs at nondot.org
Reporter: heavenandhell171 at gmail.com
CC: llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160517/38ea81fd/attachment.html>
More information about the llvm-bugs
mailing list