[llvm-bugs] [Bug 25055] New: decltype of parenthesized xvalue does not correctly yield rvalue-reference

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 5 06:10:03 PDT 2015


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

            Bug ID: 25055
           Summary: decltype of parenthesized xvalue does not correctly
                    yield rvalue-reference
           Product: clang
           Version: 3.7
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: treh at think-cell.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code snippet contains the parenthesized decltype of an xvalue:

#include <type_traits>

struct Member {};
struct A { Member x; };
A MakeA();

static_assert(std::is_same<decltype((MakeA().x)), Member&&>::value, ""); //
MSVC++ 2015
//static_assert(std::is_same<decltype((MakeA().x)), Member>::value, ""); //
clang, gcc

The standard says in ยง7.1.6.2 about decltype(e)
(4.1) [...] unparenthesized case, does not apply here
(4.2) if e is an xvalue, decltype(e) is T&&, where T is the type of e;

This means clang and gcc are not standard-conformant.

-- 
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/20151005/0799180a/attachment-0001.html>


More information about the llvm-bugs mailing list