llvm-project/clang/test/SemaCXX/pr25181-crash-on-invalid.cpp
Matheus Izvekov dbd82f33b5
[clang] NNS: don't print trailing scope resolution operator in diagnostics (#130529)
This clears up the printing of a NestedNameSpecifier so a trailing '::'
is not printed, unless it refers into the global scope.

This fixes a bunch of diagnostics where the trailing :: was awkward.
This also prints the NNS quoted consistenty.

There is a drive-by improvement to error recovery, where now we print
the actual type instead of `<dependent type>`.

This will clear up further uses of NNS printing in further patches.
2025-03-10 09:37:38 -03:00

8 lines
466 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// Don't crash (PR25181).
template <typename T> class Foo { // expected-note {{template parameter is declared here}}
template <typename T> // expected-error {{declaration of 'T' shadows template parameter}}
void Foo<T>::method(T *) const throw() {} // expected-error {{nested name specifier 'Foo<T>' for declaration does not refer into a class, class template or class template partial specialization}}
};