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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to