[all-commits] [llvm/llvm-project] 2c047e: [clang] Add fixit for using declaration with a (qu...

Nico Weber via All-commits all-commits at lists.llvm.org
Fri Jun 7 11:09:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2c047e67a5bfb479d7422f5b270e7f90ae037508
      https://github.com/llvm/llvm-project/commit/2c047e67a5bfb479d7422f5b270e7f90ae037508
  Author: Nico Weber <thakis at chromium.org>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p6-cxx11.cpp
    M clang/test/CXX/drs/cwg4xx.cpp

  Log Message:
  -----------
  [clang] Add fixit for using declaration with a (qualified) namespace (#94762)

For `using std::literals`, we now output:

    error: using declaration cannot refer to a namespace
        4 |   using std::literals;
          |         ~~~~~^
    note: did you mean 'using namespace'?
        4 |   using std::literals;
          |         ^
          |         namespace

Previously, we didn't have the note.

This only fires for qualified namespaces. Just `using std;` doesn't
trigger this, since using declarations without cxx scope specifier are
rejected earlier. Making that work is an exercise for future selves :)



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