llvm-for-llvmta/tools/clang/test/SemaCXX/warn-self-assign-overloaded...

19 lines
623 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wself-assign-overloaded -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wall -Wno-self-assign-overloaded -DSILENCE -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wself-assign -Wno-self-assign-overloaded -DSILENCE -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wself-assign-overloaded -Wno-self-assign-overloaded -DSILENCE -verify %s
struct S {};
void f() {
S a;
#ifndef SILENCE
a = a; // expected-warning{{explicitly assigning}}
#else
// expected-no-diagnostics
a = a;
#endif
}