forked from OSchip/llvm-project
Downgrade the Error on an 'inline' operator new or delete to an ExtWarn. Some
projects are relying on such (questionable) practices, so we should give them a way to opt out of this diagnostic. llvm-svn: 194905
This commit is contained in:
parent
b83422612a
commit
13dfdc88a9
|
@ -5961,8 +5961,9 @@ def err_operator_new_delete_declared_in_namespace : Error<
|
|||
"%0 cannot be declared inside a namespace">;
|
||||
def err_operator_new_delete_declared_static : Error<
|
||||
"%0 cannot be declared static in global scope">;
|
||||
def err_operator_new_delete_declared_inline : Error<
|
||||
"replacement function %0 cannot be declared 'inline'">;
|
||||
def ext_operator_new_delete_declared_inline : ExtWarn<
|
||||
"replacement function %0 cannot be declared 'inline'">,
|
||||
InGroup<DiagGroup<"inline-new-delete">>;
|
||||
def err_operator_new_delete_invalid_result_type : Error<
|
||||
"%0 must return type %1">;
|
||||
def err_operator_new_delete_dependent_result_type : Error<
|
||||
|
|
|
@ -6879,7 +6879,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
|
|||
// N.B. We diagnose declarations instead of definitions per LWG issue 2340.
|
||||
if (isInline && NewFD->isReplaceableGlobalAllocationFunction())
|
||||
Diag(D.getDeclSpec().getInlineSpecLoc(),
|
||||
diag::err_operator_new_delete_declared_inline)
|
||||
diag::ext_operator_new_delete_declared_inline)
|
||||
<< NewFD->getDeclName();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void* operator new(size_t, int*); // expected-note 3 {{candidate}}
|
|||
void* operator new(size_t, float*); // expected-note 3 {{candidate}}
|
||||
void* operator new(size_t, S); // expected-note 2 {{candidate}}
|
||||
|
||||
inline void operator delete(void *); // expected-error {{replacement function 'operator delete' cannot be declared 'inline'}}
|
||||
inline void operator delete(void *); // expected-warning {{replacement function 'operator delete' cannot be declared 'inline'}}
|
||||
|
||||
struct foo { };
|
||||
|
||||
|
|
Loading…
Reference in New Issue