llvm-project/clang/test/Parser/namelookup-anonymous-struct.c
Yanzuo Liu 9d22095632
[Clang] Remove IDNS_Ordinary flag in IndirectFieldDecl::IdentifierNamespace (#100525)
There is a `IDNS_Ordinary` flag in
`IndirectFieldDecl::IdentifierNamespace` so that members in nested
anonymous struct/union can be found as ordinary identifiers.

```c
struct S {
  struct { int x; };
  // Previous behaviour: `x` in previous line is found
  // Expected: nothing is found
  int arr[sizeof(x)];
};
```

This PR fixes this issue.

Fixes #31295.
2024-07-26 08:39:46 -04:00

7 lines
157 B
C

// RUN: %clang_cc1 -std=c11 -verify %s
struct GH31295 {
struct { int x; };
int arr[sizeof(x)]; // expected-error{{use of undeclared identifier 'x'}}
};