From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaCXX/address-of-temporary.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 clang/test/SemaCXX/address-of-temporary.cpp (limited to 'clang/test/SemaCXX/address-of-temporary.cpp') diff --git a/clang/test/SemaCXX/address-of-temporary.cpp b/clang/test/SemaCXX/address-of-temporary.cpp new file mode 100644 index 0000000..eb5dee5 --- /dev/null +++ b/clang/test/SemaCXX/address-of-temporary.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-error=address-of-temporary -verify %s +struct X { + X(); + X(int); + X(int, int); +}; + +void f0() { (void)&X(); } // expected-warning{{taking the address of a temporary object}} +void f1() { (void)&X(1); } // expected-warning{{taking the address of a temporary object}} +void f2() { (void)&X(1, 2); } // expected-warning{{taking the address of a temporary object}} +void f3() { (void)&(X)1; } // expected-warning{{taking the address of a temporary object}} + -- cgit v1.2.3