[all-commits] [llvm/llvm-project] 39879e: [Sema] Note member decl when initializer list defa...

Brian Foley via All-commits all-commits at lists.llvm.org
Mon Feb 3 10:58:00 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 39879e4f4022d2845de14810532f633e553fa650
      https://github.com/llvm/llvm-project/commit/39879e4f4022d2845de14810532f633e553fa650
  Author: Brian Foley <bpfoley at gmail.com>
  Date:   2025-02-03 (Mon, 03 Feb 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaInit.cpp
    A clang/test/CXX/class/class.init/p1.cpp
    M clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
    M clang/test/SemaCUDA/inherited-ctor.cu

  Log Message:
  -----------
  [Sema] Note member decl when initializer list default constructs member (#121854)

Recently I had a scenario where I had:
1. A class C with many members m_1...m_n of the same type T
2. T's default constructor was deleted
3. I accidentally omitted an explicitly constructed member in the
initializer list C() : m_1(foo), m_2(bar), ... { }

Clang told me that T's default constructor was deleted, and told me that
the call to T() was in C() (which it implicitly was), but didn't tell me
which member was being default constructed.

It was difficult to fix this problem because I had no easy way to list
all the members of type T in C and C's superclasses which would have let
me find which member was missing,

clang/test/CXX/class/class.init/p1.cpp is a simplified version of this
problem (a2 is missing from the initializer list of B)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list