[llvm-bugs] [Bug 44932] New: Different interpretation between GCC and clang in resolution of DR1579

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 16 08:50:45 PST 2020


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

            Bug ID: 44932
           Summary: Different interpretation between GCC and clang in
                    resolution of DR1579
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: harald at gigawatt.nl
                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

Hi,

  struct A { A(); A(const A &); A(A &&); };
  struct B { B(A); };
  B f() { A a; return a; }

GCC will use A's move constructor, clang will use A's copy constructor. The
literal text of the standard leaves some room for interpretation, IMO, as it
only says the treating of a as an rvalue applies to the selection of B's
constructor, and GCC and clang agree on which of B's constructors gets called,
but I would think that GCC's behaviour is probably what's intended.

Seen in clang 9, but appears to still apply to current trunk.

-- 
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/20200216/3a8f9337/attachment.html>


More information about the llvm-bugs mailing list