In C++11, promote access declaration diagnostic from warning to error. There
doesn't seem to be any value in even adding a -W flag for this. llvm-svn: 183882
This commit is contained in:
parent
8ca78a16f4
commit
f026b60099
|
@ -287,6 +287,9 @@ def note_using_decl : Note<"%select{|previous }0using declaration">;
|
|||
def warn_access_decl_deprecated : Warning<
|
||||
"access declarations are deprecated; use using declarations instead">,
|
||||
InGroup<Deprecated>;
|
||||
def err_access_decl : Error<
|
||||
"ISO C++11 does not allow access declarations; "
|
||||
"use using declarations instead">;
|
||||
def warn_exception_spec_deprecated : Warning<
|
||||
"dynamic exception specifications are deprecated">,
|
||||
InGroup<Deprecated>, DefaultIgnore;
|
||||
|
|
|
@ -6742,8 +6742,10 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S,
|
|||
// diagnostics.
|
||||
if (!HasUsingKeyword) {
|
||||
UsingLoc = Name.getLocStart();
|
||||
|
||||
Diag(UsingLoc, diag::warn_access_decl_deprecated)
|
||||
|
||||
Diag(UsingLoc,
|
||||
getLangOpts().CPlusPlus11 ? diag::err_access_decl
|
||||
: diag::warn_access_decl_deprecated)
|
||||
<< FixItHint::CreateInsertion(SS.getRange().getBegin(), "using ");
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ void stuff() {
|
|||
|
||||
struct S { int n; };
|
||||
struct T : private S {
|
||||
// FIXME: This is ill-formed in C++11.
|
||||
S::n; // expected-warning {{access declarations are deprecated; use using declarations instead}}
|
||||
S::n;
|
||||
#if __cplusplus < 201103L
|
||||
// expected-warning@-2 {{access declarations are deprecated; use using declarations instead}}
|
||||
#else
|
||||
// expected-error@-4 {{ISO C++11 does not allow access declarations; use using declarations instead}}
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue