[llvm-bugs] [Bug 43006] New: NRVO does not happen for template function with return type deduction

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 15 08:51:06 PDT 2019


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

            Bug ID: 43006
           Summary: NRVO does not happen for template function with return
                    type deduction
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nok.raven at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

struct X
{
    X();
    X(X&&);
};

template <int>
decltype(auto) foo()
{
    X x;
    return x;
}

template decltype(auto) foo<0>();


GCC and MSVC does not have such a limitation https://gcc.godbolt.org/z/dSWI4m

-- 
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/20190815/3bd62349/attachment.html>


More information about the llvm-bugs mailing list