From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001
From: dim <dim@FreeBSD.org>
Date: Sun, 22 Dec 2013 00:07:40 +0000
Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4
 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841

---
 test/SemaCXX/builtins.cpp | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'test/SemaCXX/builtins.cpp')

diff --git a/test/SemaCXX/builtins.cpp b/test/SemaCXX/builtins.cpp
index 5d61690..69bdfa6 100644
--- a/test/SemaCXX/builtins.cpp
+++ b/test/SemaCXX/builtins.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++11
 typedef const struct __CFString * CFStringRef;
 #define CFSTR __builtin___CFStringMakeConstantString
 
@@ -24,3 +24,23 @@ void f2() {
 // pr14895
 typedef __typeof(sizeof(int)) size_t;
 extern "C" void *__builtin_alloca (size_t);
+
+namespace addressof {
+  struct S {} s;
+  static_assert(__builtin_addressof(s) == &s, "");
+
+  struct T { constexpr T *operator&() const { return nullptr; } int n; } t;
+  constexpr T *pt = __builtin_addressof(t);
+  static_assert(&pt->n == &t.n, "");
+
+  struct U { int n : 5; } u;
+  int *pbf = __builtin_addressof(u.n); // expected-error {{address of bit-field requested}}
+
+  S *ptmp = __builtin_addressof(S{}); // expected-error {{taking the address of a temporary}}
+}
+
+void no_ms_builtins() {
+  __assume(1); // expected-error {{use of undeclared}}
+  __noop(1); // expected-error {{use of undeclared}}
+  __debugbreak(); // expected-error {{use of undeclared}}
+}
-- 
cgit v1.1