[clang] [clang] Reject 'auto' storage class with type specifier in C++ (PR #166004)

Alex Bradbury via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 9 04:47:29 PDT 2026


asb wrote:

This seems to be causing failures on all of my two-stage builders when compiling X86LoadValueInjectionLoadHardening.cpp.

I believe this repro.cpp should demonstrate the issue:
```
  namespace llvm {
  class Use;

  namespace rdf {
  template <class T> struct NodeAddr {};
  class UseNode;
  using Use = NodeAddr<UseNode *>;
  }
  }

  using namespace llvm;

  namespace {
  void f() {
    using namespace rdf;
    auto Use = 0;
  }
  }
```
Output:
```
/bin/clang++ -target x86_64-unknown-linux-gnu -std=c++17 -fsyntax-only repro.cpp
repro.cpp:16:8: error: reference to 'Use' is ambiguous
   16 |   auto Use = 0;
      |        ^
repro.cpp:7:7: note: candidate found by name lookup is 'llvm::rdf::Use'
    7 | using Use = NodeAddr<UseNode *>;
      |       ^
repro.cpp:2:7: note: candidate found by name lookup is 'llvm::Use'
    2 | class Use;
      |       ^
1 error generated.
exit code: 1
```

Checked manually, but minimised case and narrowing down the bad commit was assisted by LLM.


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


More information about the cfe-commits mailing list