mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-11 04:06:20 +00:00
![Richard Smith](/assets/img/avatar_default.png)
template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308
25 lines
725 B
C++
25 lines
725 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
// PR10355
|
|
template<typename T> void template_id1() {
|
|
template_id2<> t; // expected-error-re {{no template named 'template_id2'{{$}}}}
|
|
}
|
|
|
|
// FIXME: It would be nice if we could get this correction right.
|
|
namespace PR12297 {
|
|
namespace A {
|
|
typedef short T;
|
|
|
|
namespace B {
|
|
typedef short T;
|
|
|
|
T global(); // expected-note {{'::PR12297::global' declared here}}
|
|
}
|
|
}
|
|
|
|
using namespace A::B;
|
|
|
|
// FIXME: Adding '::PR12297::' is not needed as removing 'A::' is sufficient
|
|
T A::global(); // expected-error {{out-of-line declaration of 'global' does not match any declaration in namespace 'PR12297::A'; did you mean '::PR12297::global'?}}
|
|
}
|