brintos

brintos / llvm-project-archived public Read only

0
0
Text · 593 B · 16893d2 Raw
26 lines · cpp
1// RUN: %check_clang_tidy %s google-runtime-operator %t2 3struct Foo {4  void *operator&();5// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not overload unary operator&, it is dangerous. [google-runtime-operator]6};7 8template <typename T>9struct TFoo {10  T *operator&();11// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not overload unary operator&12};13 14TFoo<int> tfoo;15 16struct Bar;17void *operator&(Bar &b);18// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not overload unary operator&19 20// No warnings on binary operators.21struct Qux {22  void *operator&(Qux &q);23};24 25void *operator&(Qux &q, Qux &r);26