[all-commits] [llvm/llvm-project] 01cf79: [clang] Fix conflicting declaration error with usi...

PiJoules via All-commits all-commits at lists.llvm.org
Wed Apr 1 11:18:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 01cf792d1e68b28104c777927acf18fda3d41a95
      https://github.com/llvm/llvm-project/commit/01cf792d1e68b28104c777927acf18fda3d41a95
  Author: PiJoules <leonardchan at google.com>
  Date:   2026-04-01 (Wed, 01 Apr 2026)

  Changed paths:
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/test/SemaCXX/using-if-exists.cpp

  Log Message:
  -----------
  [clang] Fix conflicting declaration error with using_if_exists (#167646)

This fixes an issue with using_if_exists where we would hit `conflicts
with target of using declaration already in scope` with a
using_if_exists attribute referring to a declaration which did not
exist. That is, if we have `using ::bar
__attribute__((using_if_exists))` but `bar` is not in the global
namespace, then nothing should actually be declared here.

This PR contains the following changes:
1. Ensure we only diagnose this error if the target decl and [Non]Tag
decl can be substitutes for each other.
2. Prevent LookupResult from considering UnresolvedUsingIfExistsDecls in
the event of ambiguous results.
3. Update tests. This includes the minimal repo for a regression test,
and changes to existing tests which also seem to exhibit this bug.

Fixes #85335

---------

Co-authored-by: Petr Hosek <phosek at google.com>



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