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

             Bug #: 13311
           Summary: [C++11] cannot return rvalue reference to function
                    type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


The following code fails to compile:

  #include <type_traits>
  void bar() {}
  void (&&foo())() { return static_cast<void (&&)()>(bar); }
  static_assert(std::is_same<decltype(foo()), void (&&)()>::value, "");

In my understanding, rvalue references to function types are allowed, and clang
seems to agree. However, clang refuses to return one. Instead, it gets turned
into an lvalue reference to function type. The following succeeds:

  // Shouldn't compile but does, IIUC
  static_assert(std::is_same<decltype(foo()), void (&)()>::value, "");

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