summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-unused-variables.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2009-12-24 00:28:18 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2009-12-24 00:28:18 +0000
commitc095b5361a5a8d949f42a5f6ce50b80254e88396 (patch)
tree416d1947290369297f8c02a0df3db389c945c008 /clang/test/SemaCXX/warn-unused-variables.cpp
parent8bc072cda6adeca730991f9e0c88c93c7e67597c (diff)
downloadbcm5719-llvm-c095b5361a5a8d949f42a5f6ce50b80254e88396.tar.gz
bcm5719-llvm-c095b5361a5a8d949f42a5f6ce50b80254e88396.zip
support the warn_unused_result in C++ class methods
llvm-svn: 92095
Diffstat (limited to 'clang/test/SemaCXX/warn-unused-variables.cpp')
-rw-r--r--clang/test/SemaCXX/warn-unused-variables.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-unused-variables.cpp b/clang/test/SemaCXX/warn-unused-variables.cpp
index 83a61bf8e00..5620248f500 100644
--- a/clang/test/SemaCXX/warn-unused-variables.cpp
+++ b/clang/test/SemaCXX/warn-unused-variables.cpp
@@ -32,3 +32,14 @@ namespace PR5531 {
C();
}
}
+
+
+struct X {
+ int foo() __attribute__((warn_unused_result));
+};
+
+void bah() {
+ X x, *x2;
+ x.foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+ x2->foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+}
OpenPOWER on IntegriCloud