Other compilers accept invalid code here that we reject, and we need a
better error message to try to convince users that the code is really
incorrect. Consider:
class Foo {
typedef MyIterHelper<Foo> iterator;
friend class iterator;
};
Previously our wording was "elaborated type refers to a typedef".
"elaborated type" isn't widely known terminology, so the new diagnostic
says "typedef 'iterator' cannot be referenced with class specifier".
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D25216
llvm-svn: 289259
17 lines
377 B
C++
17 lines
377 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
template <typename T>
|
|
struct A {
|
|
typedef int iterator; // expected-note{{declared here}}
|
|
};
|
|
|
|
template <typename T>
|
|
void f() {
|
|
class A <T> ::iterator foo; // expected-error{{typedef 'iterator' cannot be referenced with a class specifier}}
|
|
}
|
|
|
|
void g() {
|
|
f<int>(); // expected-note{{in instantiation of function template}}
|
|
}
|
|
|