[all-commits] [llvm/llvm-project] 4ccb6c: Fix violations of [basic.class.scope]p2.

Richard Smith via All-commits all-commits at lists.llvm.org
Mon Jun 1 22:03:27 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ccb6c36a9159809f4b98176325ae202753fe136
      https://github.com/llvm/llvm-project/commit/4ccb6c36a9159809f4b98176325ae202753fe136
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-06-01 (Mon, 01 Jun 2020)

  Changed paths:
    M clang/lib/Analysis/CFG.cpp
    M clang/utils/TableGen/NeonEmitter.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
    M llvm/lib/CodeGen/InterferenceCache.h

  Log Message:
  -----------
  Fix violations of [basic.class.scope]p2.

These cases all follow the same pattern:

struct A {
  friend class X;
  //...
  class X {};
};

But 'friend class X;' injects 'X' into the surrounding namespace scope,
rather than introducing a class member. So the second 'class X {}' is a
completely different type, which changes the meaning of the earlier name
'X' from '::X' to 'A::X'.

Additionally, the friend declaration is pointless -- members of a class
don't need to be befriended to be able to access private members.




More information about the All-commits mailing list