[llvm-bugs] [Bug 44468] New: Cannot access members of temporary objects created via CTAD

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 6 02:50:18 PST 2020


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

            Bug ID: 44468
           Summary: Cannot access members of temporary objects created via
                    CTAD
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tony.wasserka at gmx.de
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

When creating temporary objects of deduced template argument type, clang fails
to compile a program that attempts to access a member of the created object.
Example: `MyTemplate { t }.a`.

A workaround is to wrap the created object in an std::move, like
`std::move(MyTemplate { t }).a`.

Interestingly, this issue only seems to happen when the constructor argument
itself is a dependent name.

Full example: https://godbolt.org/z/Tj6TC7 . GCC and MSVC consider this example
valid.

-- 
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/20200106/9dff535e/attachment.html>


More information about the llvm-bugs mailing list