[clang] [Clang] Implement CWG3005 Function parameters should never be name-independent (PR #138245)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 02:54:20 PDT 2025


================

----------------
Endilll wrote:

I'm not going to bother you with the description of what I want to see in this file. Here you go:
```cpp
// RUN: %clang_cc1 -std=c++98 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected %s
// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected %s


namespace cwg3005 { // cwg3005: 21 open 2025-03-10

void f(
  int _, // #cwg3005-first-param
  int _)
  // expected-error at -1 {{redefinition of parameter '_'}}
  //   expected-note@#cwg3005-first-param {{previous declaration is here}}
{
  int _;
  // expected-error at -1 {{redefinition of '_'}}
  //   expected-note@#cwg3005-first-param {{previous declaration is here}}
}

} // namespace cwg3005
```

https://github.com/llvm/llvm-project/pull/138245


More information about the cfe-commits mailing list