[llvm-bugs] [Bug 41450] New: Invalid error "member reference base type "T" is not a structure or union"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 10 07:06:38 PDT 2019


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

            Bug ID: 41450
           Summary: Invalid error "member reference base type "T" is not a
                    structure or union"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++'17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kyrylo.bohdanenko at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Consider the following code:

  template <typename T>
  struct Check {
    explicit Check(T) {}
    auto copy() const { return *this; } 
  };

  int main() {
    static_cast<void>([](const auto& range) {
      Check{range}.copy();
    });
  }

Clang issues an error:

  prog.cc:9:17: error: member reference base type 'Check' is not a structure or
union
      Check{range}.copy();
      ~~~~~~~~~~~~^~~~~

The error is clearly invalid. The code should be compilable.
Sandbox is available on Wandbox: https://wandbox.org/permlink/9ImPrkZ90K9ZM2QL

In order for the fragment above to work, the problem line should be rewritten
as follows:

      Check c{range};
      std::move(c).copy();

-- 
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/20190410/e7b495f2/attachment.html>


More information about the llvm-bugs mailing list