[all-commits] [llvm/llvm-project] 2f9769: [C] Diagnose declarations hidden in C++ (#137368)

Aaron Ballman via All-commits all-commits at lists.llvm.org
Tue Apr 29 04:58:23 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f976956e5ccef566418853015fb6b31257aa69f
      https://github.com/llvm/llvm-project/commit/2f976956e5ccef566418853015fb6b31257aa69f
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2025-04-29 (Tue, 29 Apr 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/DeclBase.h
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/Sema/decl-hidden-in-c++.c

  Log Message:
  -----------
  [C] Diagnose declarations hidden in C++ (#137368)

This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped
under -Wc++-compat, that diagnoses declarations which are valid in C but
invalid in C++ due to the type being at the wrong scope. e.g.,
```
  struct S {
    struct T {
      int x;
    } t;
  };

  struct T t; // Valid C, invalid C++
```
This is implementing the other half of #21898



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