Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp
index 0f6ebbb..3420d20 100644
--- a/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/test/SemaCXX/MicrosoftExtensions.cpp
@@ -122,7 +122,7 @@
 void f2(void); // expected-note{{previous declaration is here}}
 };
 
-__declspec(dllimport) void AAA::f2(void) { // expected-error{{'dllimport' attribute can be applied only to symbol}}
+__declspec(dllimport) void AAA::f2(void) { // expected-error{{dllimport cannot be applied to non-inline function definition}}
                                            // expected-error@-1{{redeclaration of 'AAA::f2' cannot add 'dllimport' attribute}}
 
 }
diff --git a/test/SemaCXX/addr-of-overloaded-function-casting.cpp b/test/SemaCXX/addr-of-overloaded-function-casting.cpp
index 784c8a0..edf4c13 100644
--- a/test/SemaCXX/addr-of-overloaded-function-casting.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function-casting.cpp
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 void g();
 
-void f(); // expected-note 9{{candidate function}}
-void f(int); // expected-note 9{{candidate function}}
+void f(); // expected-note 11{{candidate function}}
+void f(int); // expected-note 11{{candidate function}}
 
 template <class T>
 void t(T); // expected-note 3{{candidate function}} \
@@ -58,4 +58,13 @@
   { bool b = static_cast<int (&)(char)>(t); } // expected-error{{does not match required}}
   
   { bool b = static_cast<void (&)(char)>(f); } // expected-error{{does not match}}
+
+  {
+    // The error should be reported when casting overloaded function to the
+    // compatible function type (not to be confused with function pointer or
+    // function reference type.)
+    typedef void (FnType)(int);
+    FnType a = static_cast<FnType>(f); // expected-error{{address of overloaded function}}
+    FnType b = (FnType)(f); // expected-error{{address of overloaded function}}
+  }
 }
diff --git a/test/SemaCXX/ast-print.cpp b/test/SemaCXX/ast-print.cpp
index 3d98fd8..4851571 100644
--- a/test/SemaCXX/ast-print.cpp
+++ b/test/SemaCXX/ast-print.cpp
@@ -196,3 +196,15 @@
     return;
 }
 };
+
+namespace {
+void test(int i) {
+  switch (i) {
+    case 1:
+      // CHECK: {{\[\[clang::fallthrough\]\]}}
+      [[clang::fallthrough]];
+    case 2:
+      break;
+  }
+}
+}
diff --git a/test/SemaCXX/attr-flatten.cpp b/test/SemaCXX/attr-flatten.cpp
new file mode 100644
index 0000000..afcba72
--- /dev/null
+++ b/test/SemaCXX/attr-flatten.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+int i __attribute__((flatten)); // expected-error {{'flatten' attribute only applies to functions}}
+
+void f1() __attribute__((flatten));
+void f2() __attribute__((flatten(1))); // expected-error {{'flatten' attribute takes no arguments}}
+
+template <typename T>
+void tf1() __attribute__((flatten));
+
+int f3(int __attribute__((flatten)), int); // expected-error{{'flatten' attribute only applies to functions}}
+
+struct A {
+  int f __attribute__((flatten));  // expected-error{{'flatten' attribute only applies to functions}}
+  void mf1() __attribute__((flatten));
+  static void mf2() __attribute__((flatten));
+};
+
+int ci [[gnu::flatten]]; // expected-error {{'flatten' attribute only applies to functions}}
+
+[[gnu::flatten]] void cf1();
+[[gnu::flatten(1)]] void cf2(); // expected-error {{'flatten' attribute takes no arguments}}
+
+template <typename T>
+[[gnu::flatten]]
+void ctf1();
+
+int cf3(int c[[gnu::flatten]], int); // expected-error{{'flatten' attribute only applies to functions}}
+
+struct CA {
+  int f [[gnu::flatten]];  // expected-error{{'flatten' attribute only applies to functions}}
+  [[gnu::flatten]] void mf1();
+  [[gnu::flatten]] static void mf2();
+};
diff --git a/test/SemaCXX/attr-no-sanitize-address.cpp b/test/SemaCXX/attr-no-sanitize-address.cpp
index f180349..9ca2863 100644
--- a/test/SemaCXX/attr-no-sanitize-address.cpp
+++ b/test/SemaCXX/attr-no-sanitize-address.cpp
@@ -15,23 +15,23 @@
 
 int noanal_testfn(int y) {
   int x NO_SANITIZE_ADDRESS = y; // \
-    // expected-error {{'no_sanitize_address' attribute only applies to functions and methods}}
+    // expected-error {{'no_sanitize_address' attribute only applies to functions}}
   return x;
 }
 
 int noanal_test_var NO_SANITIZE_ADDRESS; // \
-  // expected-error {{'no_sanitize_address' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_address' attribute only applies to functions}}
 
 class NoanalFoo {
  private:
   int test_field NO_SANITIZE_ADDRESS; // \
-    // expected-error {{'no_sanitize_address' attribute only applies to functions and methods}}
+    // expected-error {{'no_sanitize_address' attribute only applies to functions}}
   void test_method() NO_SANITIZE_ADDRESS;
 };
 
 class NO_SANITIZE_ADDRESS NoanalTestClass { // \
-  // expected-error {{'no_sanitize_address' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_address' attribute only applies to functions}}
 };
 
 void noanal_fun_params(int lvar NO_SANITIZE_ADDRESS); // \
-  // expected-error {{'no_sanitize_address' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_address' attribute only applies to functions}}
diff --git a/test/SemaCXX/attr-no-sanitize-memory.cpp b/test/SemaCXX/attr-no-sanitize-memory.cpp
index d6eca1b..9cbcb03 100644
--- a/test/SemaCXX/attr-no-sanitize-memory.cpp
+++ b/test/SemaCXX/attr-no-sanitize-memory.cpp
@@ -15,23 +15,23 @@
 
 int noanal_testfn(int y) {
   int x NO_SANITIZE_MEMORY = y; // \
-    // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}}
+    // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
   return x;
 }
 
 int noanal_test_var NO_SANITIZE_MEMORY; // \
-  // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
 
 class NoanalFoo {
  private:
   int test_field NO_SANITIZE_MEMORY; // \
-    // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}}
+    // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
   void test_method() NO_SANITIZE_MEMORY;
 };
 
 class NO_SANITIZE_MEMORY NoanalTestClass { // \
-  // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
 };
 
 void noanal_fun_params(int lvar NO_SANITIZE_MEMORY); // \
-  // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
diff --git a/test/SemaCXX/attr-no-sanitize-thread.cpp b/test/SemaCXX/attr-no-sanitize-thread.cpp
index d6372bc..6cb9c71 100644
--- a/test/SemaCXX/attr-no-sanitize-thread.cpp
+++ b/test/SemaCXX/attr-no-sanitize-thread.cpp
@@ -15,23 +15,23 @@
 
 int noanal_testfn(int y) {
   int x NO_SANITIZE_THREAD = y; // \
-    // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
+    // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
   return x;
 }
 
 int noanal_test_var NO_SANITIZE_THREAD; // \
-  // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
 
 class NoanalFoo {
  private:
   int test_field NO_SANITIZE_THREAD; // \
-    // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
+    // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
   void test_method() NO_SANITIZE_THREAD;
 };
 
 class NO_SANITIZE_THREAD NoanalTestClass { // \
-  // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
 };
 
 void noanal_fun_params(int lvar NO_SANITIZE_THREAD); // \
-  // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
+  // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
diff --git a/test/SemaCXX/attr-no-split-stack.cpp b/test/SemaCXX/attr-no-split-stack.cpp
new file mode 100644
index 0000000..3575e99
--- /dev/null
+++ b/test/SemaCXX/attr-no-split-stack.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+int i __attribute__((no_split_stack)); // expected-error {{'no_split_stack' attribute only applies to functions}}
+
+void f1() __attribute__((no_split_stack));
+void f2() __attribute__((no_split_stack(1))); // expected-error {{'no_split_stack' attribute takes no arguments}}
+
+template <typename T>
+void tf1() __attribute__((no_split_stack));
+
+int f3(int __attribute__((no_split_stack)), int); // expected-error{{'no_split_stack' attribute only applies to functions}}
+
+struct A {
+  int f __attribute__((no_split_stack));  // expected-error{{'no_split_stack' attribute only applies to functions}}
+  void mf1() __attribute__((no_split_stack));
+  static void mf2() __attribute__((no_split_stack));
+};
+
+int ci [[gnu::no_split_stack]]; // expected-error {{'no_split_stack' attribute only applies to functions}}
+
+[[gnu::no_split_stack]] void cf1();
+[[gnu::no_split_stack(1)]] void cf2(); // expected-error {{'no_split_stack' attribute takes no arguments}}
+
+template <typename T>
+[[gnu::no_split_stack]]
+void ctf1();
+
+int cf3(int c[[gnu::no_split_stack]], int); // expected-error{{'no_split_stack' attribute only applies to functions}}
+
+struct CA {
+  int f [[gnu::no_split_stack]];  // expected-error{{'no_split_stack' attribute only applies to functions}}
+  [[gnu::no_split_stack]] void mf1();
+  [[gnu::no_split_stack]] static void mf2();
+};
diff --git a/test/SemaCXX/bool-compare.cpp b/test/SemaCXX/bool-compare.cpp
new file mode 100644
index 0000000..fe47633
--- /dev/null
+++ b/test/SemaCXX/bool-compare.cpp
@@ -0,0 +1,207 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+
+void f(int x, int y, int z) {
+
+  bool a,b;
+
+  if(b > true)    {} // expected-warning {{comparison of true with expression of type 'bool' is always false}}
+  if(b < true)    {} // no warning
+  if(b >= true)   {} // no warning
+  if(b <= true)   {} // expected-warning {{comparison of true with expression of type 'bool' is always true}}
+  if(b == true)   {} // no warning
+  if(b != true)   {} // no warning
+
+  if(b > false)   {} // no warning
+  if(b < false)   {} // expected-warning {{comparison of false with expression of type 'bool' is always false}}
+  if(b >= false)  {} // expected-warning {{comparison of false with expression of type 'bool' is always true}}
+  if(b <= false)  {} // no warning
+  if(b == false)  {} // no warning
+  if(b != false)  {} // no warning
+
+  if(b > 1U){} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+
+  if (a > b)      {} // no warning
+  if (a < b)      {} // no warning
+  if (a >= b)     {} // no warning
+  if (a <= b)     {} // no warning
+  if (a == b)     {} // no warning
+  if (a != b)     {} // no warning
+
+  if (a > 0) {} // no warning
+  if (a > 1) {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+  if (a > 2) {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+
+  if (a >= 0) {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always true}}
+  if (a >= 1) {} // no warning
+  if (a >= 2) {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if (a >= -1) {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if (a <= 0) {} // no warning
+  if (a <= 1) {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always true}}
+  if (a <= 2) {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if (a <= -1) {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if (!a > 0)     {} // no warning
+  if (!a > 1)     {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+  if (!a > 2)     {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if (!a > y)     {} // no warning
+  if (!a > b)     {} // no warning
+  if (!a > -1)    {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if (!a < 0)     {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always false}}
+  if (!a < 1)     {} // no warning
+  if (!a < 2)     {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if (!a < y)     {} // no warning
+  if (!a < b)     {} // no warning
+  if (!a < -1)    {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if (!a >= 0)    {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always true}}
+  if (!a >= 1)    {} // no warning
+  if (!a >= 2)    {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if (!a >= y)    {} // no warning
+  if (!a >= b)    {} // no warning
+  if (!a >= -1)   {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if (!a <= 0)    {} // no warning
+  if (!a <= 1)    {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always true}}
+  if (!a <= 2)    {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if (!a <= y)    {} // no warning
+  if (!a <= b)    {} // no warning
+  if (!a <= -1)   {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if ((a||b) > 0) {} // no warning
+  if ((a||b) > 1) {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+  if ((a||b) > 4) {} // expected-warning {{comparison of constant 4 with expression of type 'bool' is always false}}
+  if ((a||b) > -1) {}// expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if ((a&&b) > 0) {} // no warning
+  if ((a&&b) > 1) {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+  if ((a&&b) > 4) {} // expected-warning {{comparison of constant 4 with expression of type 'bool' is always false}}
+
+  if ((a<y) > 0)  {} // no warning
+  if ((a<y) > 1)  {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+  if ((a<y) > 4)  {} // expected-warning {{comparison of constant 4 with expression of type 'bool' is always false}}
+  if ((a<y) > z)  {} // no warning
+  if ((a<y) > -1) {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if ((a<y) == 0) {} // no warning
+  if ((a<y) == 1) {} // no warning
+  if ((a<y) == 2) {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if ((a<y) == z) {} // no warning
+  if ((a<y) == -1) {}// expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if ((a<y) != 0) {} // no warning
+  if ((a<y) != 1) {} // no warning
+  if ((a<y) != 2) {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if ((a<y) != z) {} // no warning
+  if ((a<y) != -1) {}// expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if ((a<y) == z) {} // no warning
+  if (a>y<z)      {} // no warning
+  if ((a<y) > z)  {} // no warning
+  if((a<y)>(z<y)) {} // no warning
+  if((a<y)==(z<y)){} // no warning
+  if((a<y)!=(z<y)){} // no warning
+  if((z==x)<(y==z)){}  // no warning
+  if((a<y)!=((z==x)<(y==z))){} // no warning
+
+
+  if (0 > !a)     {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always false}}
+  if (1 > !a)     {} // no warning
+  if (2 > !a)     {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if (y > !a)     {} // no warning
+  if (-1 > !a)    {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if (0 < !a)     {} // no warning
+  if (1 < !a)     {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always false}}
+  if (2 < !a)     {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if (y < !a)     {} // no warning
+  if (-1 < !a)    {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+
+  if (0 >= !a)    {} // no warning
+  if (1 >= !a)    {} // expected-warning {{comparison of constant 1 with expression of type 'bool' is always true}}
+  if (2 >= !a)    {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if (y >= !a)    {} // no warning
+  if (-1 >= !a)   {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if (0 <= !a)    {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always true}}
+  if (1 <= !a)    {} // no warning
+  if (2 <= !a)    {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if (y <= !a)    {} //
+  if (-1 <= !a)   {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if (0 > (a||b)) {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always false}}
+  if (1 > (a||b)) {} // no warning
+  if (4 > (a||b)) {} // expected-warning {{comparison of constant 4 with expression of type 'bool' is always true}}
+
+  if (0 > (a&&b)) {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always false}}
+  if (1 > (a&&b)) {} // no warning
+  if (4 > (a&&b)) {} // expected-warning {{comparison of constant 4 with expression of type 'bool' is always true}}
+
+  if (0 > (a<y))  {} // expected-warning {{comparison of constant 0 with expression of type 'bool' is always false}}
+  if (1 > (a<y))  {} // no warning
+  if (4 > (a<y))  {} // expected-warning {{comparison of constant 4 with expression of type 'bool' is always true}}
+  if (z > (a<y))  {} //
+  if (-1 > (a<y)) {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if (0 == (a<y)) {} // no warning
+  if (1 == (a<y)) {} // no warning
+  if (2 == (a<y)) {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always false}}
+  if (z == (a<y)) {} // no warning
+  if (-1 == (a<y)){} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+
+  if (0 !=(a<y))  {} // no warning
+  if (1 !=(a<y))  {} // no warning
+  if (2 !=(a<y))  {} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if (z !=(a<y))  {} // no warning
+  if (-1 !=(a<y)) {} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always true}}
+
+  if (z ==(a<y))  {} // no warning
+  if (z<a>y)      {} // no warning
+  if (z > (a<y))  {} // no warning
+  if((z<y)>(a<y)) {} // no warning
+  if((z<y)==(a<y)){} // no warning
+  if((z<y)!=(a<y)){} // no warning
+  if((y==z)<(z==x)){} // no warning
+  if(((z==x)<(y==z))!=(a<y)){}  // no warning
+
+  if(((z==x)<(-1==z))!=(a<y)){} // no warning
+  if(((z==x)<(z==-1))!=(a<y)){} // no warning
+  if(((z==x)<-1)!=(a<y)){} // expected-warning {{comparison of constant -1 with expression of type 'bool' is always false}}
+  if(((z==x)< 2)!=(a<y)){} // expected-warning {{comparison of constant 2 with expression of type 'bool' is always true}}
+  if(((z==x)<(z>2))!=(a<y)){} // no warning
+
+}
+
+
+template<typename T, typename U, typename V> struct X6 {
+  U f(T t, U u, V v) {
+    // IfStmt
+    if (t > 0)
+      return u;
+    else {
+      if (t < 0)
+        return v; // expected-error{{cannot initialize return object of type}}
+    }
+    bool r;
+    // FIXME: We should warn here, DiagRuntimeBehavior does currently not detect this.
+    if(r<0){}
+
+    if (T x = t) {
+      t = x;
+    }
+    return v; // expected-error{{cannot initialize return object of type}}
+  }
+};
+
+struct ConvertibleToInt {
+  operator int() const;
+};
+
+template struct X6<ConvertibleToInt, float, char>;
+template struct X6<bool, int, int*>; // expected-note{{instantiation}}
+
+
+
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index 1d5700d..40ac33b 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -26,6 +26,9 @@
 public:
   void operator bool(int, ...) const; // expected-error{{conversion function cannot have a return type}} \
   // expected-error{{conversion function cannot have any parameters}}
+
+  operator bool(int a = 4, int b = 6) const; // expected-error{{conversion function cannot have any parameters}}
+  
   
   operator float(...) const;  // expected-error{{conversion function cannot be variadic}}
   
diff --git a/test/SemaCXX/cxx0x-initializer-constructor.cpp b/test/SemaCXX/cxx0x-initializer-constructor.cpp
index dc179f8..75b2341 100644
--- a/test/SemaCXX/cxx0x-initializer-constructor.cpp
+++ b/test/SemaCXX/cxx0x-initializer-constructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
 
 struct one { char c[1]; };
 struct two { char c[2]; };
@@ -75,8 +75,8 @@
     { F<0> f = {}; }
     // Narrowing conversions don't affect viability. The next two choose
     // the initializer_list constructor.
-    { F<3> f{1, 1.0}; } // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{override}}
-    { F<3> f = {1, 1.0}; } // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{override}}
+    { F<3> f{1, 1.0}; } // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{silence}}
+    { F<3> f = {1, 1.0}; } // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{silence}}
     { F<3> f{1, 2, 3, 4, 5, 6, 7, 8}; }
     { F<3> f = {1, 2, 3, 4, 5, 6, 7, 8}; }
     { F<3> f{1, 2, 3, 4, 5, 6, 7, 8}; }
@@ -304,7 +304,6 @@
   B b {}; // calls default constructor
 }
 
-
 // PR13470, <rdar://problem/11974632>
 namespace PR13470 {
   struct W {
@@ -365,3 +364,14 @@
     yi.h(); // ok, all diagnostics produced in template definition
   }
 }
+
+namespace PR19729 {
+  struct A {
+    A(int);
+    A(const A&) = delete;
+  };
+  struct B {
+    void *operator new(std::size_t, A);
+  };
+  B *p = new ({123}) B;
+}
diff --git a/test/SemaCXX/cxx0x-initializer-scalars.cpp b/test/SemaCXX/cxx0x-initializer-scalars.cpp
index 627855e..1475dcf 100644
--- a/test/SemaCXX/cxx0x-initializer-scalars.cpp
+++ b/test/SemaCXX/cxx0x-initializer-scalars.cpp
@@ -45,8 +45,8 @@
     { const int a{1, 2}; } // expected-error {{excess elements}}
     { const int a = {1, 2}; } // expected-error {{excess elements}}
     // FIXME: Redundant warnings.
-    { const short a{100000}; } // expected-error {{cannot be narrowed}} expected-note {{inserting an explicit cast}} expected-warning {{changes value}}
-    { const short a = {100000}; } // expected-error {{cannot be narrowed}} expected-note {{inserting an explicit cast}} expected-warning {{changes value}}
+    { const short a{100000}; } // expected-error {{cannot be narrowed}} expected-note {{insert an explicit cast}} expected-warning {{changes value}}
+    { const short a = {100000}; } // expected-error {{cannot be narrowed}} expected-note {{insert an explicit cast}} expected-warning {{changes value}}
     { if (const int a{1}) static_assert(a == 1, ""); }
     { if (const int a = {1}) static_assert(a == 1, ""); }
   }
diff --git a/test/SemaCXX/cxx11-inheriting-ctors.cpp b/test/SemaCXX/cxx11-inheriting-ctors.cpp
index 67d5521..04aa117 100644
--- a/test/SemaCXX/cxx11-inheriting-ctors.cpp
+++ b/test/SemaCXX/cxx11-inheriting-ctors.cpp
@@ -26,3 +26,11 @@
     return 0;
   }
 }
+
+namespace WrongIdent {
+  struct A {};
+  struct B : A {};
+  struct C : B {
+    using B::A;
+  };
+}
diff --git a/test/SemaCXX/cxx11-unused.cpp b/test/SemaCXX/cxx11-unused.cpp
new file mode 100644
index 0000000..1e25bd5
--- /dev/null
+++ b/test/SemaCXX/cxx11-unused.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s -Wunused-parameter
+
+// PR19303 : Make sure we don't get a unused expression warning for deleted and
+// defaulted functions
+
+// expected-no-diagnostics
+
+class A {
+public:
+  int x;
+  A() = default;
+  ~A() = default;
+  A(const A &other) = delete;
+
+  template <typename T>
+  void SetX(T x) {
+    this->x = x;
+  };
+
+  void SetX1(int x);
+};
+
+template <>
+void A::SetX(A x) = delete;
+
+class B {
+public:
+  B() = default;
+  ~B() = default;
+  B(const B &other);
+};
+
+B::B(const B &other) = default;
diff --git a/test/SemaCXX/cxx1y-deduced-return-type.cpp b/test/SemaCXX/cxx1y-deduced-return-type.cpp
index d3308b3..6086416 100644
--- a/test/SemaCXX/cxx1y-deduced-return-type.cpp
+++ b/test/SemaCXX/cxx1y-deduced-return-type.cpp
@@ -261,6 +261,13 @@
 
 namespace Constexpr {
   constexpr auto f1(int n) { return n; }
+  template<typename T> struct X { constexpr auto f() {} }; // PR18746
+  template<typename T> struct Y { constexpr T f() {} }; // expected-note {{control reached end of constexpr function}}
+  void f() {
+    X<int>().f();
+    Y<void>().f();
+    constexpr int q = Y<int>().f(); // expected-error {{must be initialized by a constant expression}} expected-note {{in call to '&Y<int>()->f()'}}
+  }
   struct NonLiteral { ~NonLiteral(); } nl; // expected-note {{user-provided destructor}}
   constexpr auto f2(int n) { return nl; } // expected-error {{return type 'Constexpr::NonLiteral' is not a literal type}}
 }
diff --git a/test/SemaCXX/cxx1y-variable-templates_top_level.cpp b/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
index 37d5bf3..4e62941 100644
--- a/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
+++ b/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
@@ -324,7 +324,7 @@
   template<typename T> T v = {1234};  // expected-warning {{implicit conversion from 'int' to 'char' changes value from 1234 to}}
 #ifndef PRECXX11
   // expected-error@-2 {{constant expression evaluates to 1234 which cannot be narrowed to type 'char'}}\
-  // expected-note@-2 {{override this message by inserting an explicit cast}}
+  // expected-note@-2 {{insert an explicit cast to silence this issue}}
 #endif
   int k = v<char>;        // expected-note {{in instantiation of variable template specialization 'narrowing::v<char>' requested here}}
 }
@@ -448,3 +448,13 @@
   static_assert(x<int> == 1, "");
 #endif
 }
+
+namespace PR19169 {
+  template <typename T> int* f();
+  template <typename T> void f();
+  template<> int f<double>; // expected-error {{no variable template matches specialization; did you mean to use 'f' as function template instead?}}
+  
+  template <typename T> void g();
+  template<> int g<double>; // expected-error {{no variable template matches specialization; did you mean to use 'g' as function template instead?}}
+}
+
diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp
index 8c1efc9..96af954 100644
--- a/test/SemaCXX/cxx98-compat.cpp
+++ b/test/SemaCXX/cxx98-compat.cpp
@@ -379,38 +379,22 @@
 // expected-warning@-4 {{variable templates are a C++1y extension}}
 #endif
 
+// No diagnostic for specializations of variable templates; we will have
+// diagnosed the primary template.
 template<typename T> T* var<T*> = new T();
-#ifdef CXX1YCOMPAT
-// expected-warning@-2 {{variable templates are incompatible with C++ standards before C++1y}}
-#else
-// expected-warning@-4 {{variable templates are a C++1y extension}}
-#endif
-
 template<> int var<int> = 10;
-#ifdef CXX1YCOMPAT
-// expected-warning@-2 {{variable templates are incompatible with C++ standards before C++1y}}
-#else
-// expected-warning@-4 {{variable templates are a C++1y extension}}
-#endif
-
 template int var<int>;
 float fvar = var<float>;
 
-class A {  
+class A {
   template<typename T> static T var = T(10);
 #ifdef CXX1YCOMPAT
 // expected-warning@-2 {{variable templates are incompatible with C++ standards before C++1y}}
 #else
 // expected-warning@-4 {{variable templates are a C++1y extension}}
 #endif
-  
-  template<typename T> static T* var<T*> = new T(); 
-#ifdef CXX1YCOMPAT
-// expected-warning@-2 {{variable templates are incompatible with C++ standards before C++1y}}
-#else
-// expected-warning@-4 {{variable templates are a C++1y extension}}
-#endif
 
+  template<typename T> static T* var<T*> = new T(); 
 };
 
 struct B {  template<typename T> static T v; };
@@ -428,19 +412,7 @@
 #endif
 
 template<typename T> T* B::v<T*> = new T();
-#ifdef CXX1YCOMPAT
-// expected-warning@-2 {{variable templates are incompatible with C++ standards before C++1y}}
-#else
-// expected-warning@-4 {{variable templates are a C++1y extension}}
-#endif
-
 template<> int B::v<int> = 10;
-#ifdef CXX1YCOMPAT
-// expected-warning@-2 {{variable templates are incompatible with C++ standards before C++1y}}
-#else
-// expected-warning@-4 {{variable templates are a C++1y extension}}
-#endif
-
 template int B::v<int>;
 float fsvar = B::v<float>;
 
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp
index 8164b2b..6abfb2f 100644
--- a/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -33,7 +33,7 @@
   extern T f3();
   __typeof(*T()) f4(); // expected-warning {{empty parentheses interpreted as a function declaration}} expected-note {{replace parentheses with an initializer}}
   typedef void *V;
-  __typeof(*V()) f5();
+  __typeof(*V()) f5(); // expected-error {{ISO C++ does not allow indirection on operand of type 'V' (aka 'void *')}}
   T multi1,
     multi2(); // expected-warning {{empty parentheses interpreted as a function declaration}} expected-note {{replace parentheses with an initializer}}
   T(d)[5]; // expected-error {{redefinition of 'd'}}
diff --git a/test/SemaCXX/decl-microsoft-call-conv.cpp b/test/SemaCXX/decl-microsoft-call-conv.cpp
index 4282047..eb6c850 100644
--- a/test/SemaCXX/decl-microsoft-call-conv.cpp
+++ b/test/SemaCXX/decl-microsoft-call-conv.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -verify %s
+// RUN: %clang_cc1 -triple i686-pc-mingw32 -verify %s
+// RUN: %clang_cc1 -triple i686-pc-mingw32 -fms-extensions -verify %s
 
 typedef void void_fun_t();
 typedef void __cdecl cdecl_fun_t();
diff --git a/test/SemaCXX/declspec-thread.cpp b/test/SemaCXX/declspec-thread.cpp
new file mode 100644
index 0000000..0ace9a6
--- /dev/null
+++ b/test/SemaCXX/declspec-thread.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -triple i686-pc-win32 -std=c++11 -fms-extensions -verify %s
+
+__thread __declspec(thread) int a; // expected-error {{already has a thread-local storage specifier}}
+__declspec(thread) __thread int b; // expected-error {{already has a thread-local storage specifier}}
+__declspec(thread) int c(); // expected-warning {{only applies to variables}}
+__declspec(thread) int d;
+int foo();
+__declspec(thread) int e = foo(); // expected-error {{must be a constant expression}} expected-note {{thread_local}}
+
+struct HasCtor { HasCtor(); int x; };
+__declspec(thread) HasCtor f; // expected-error {{must be a constant expression}} expected-note {{thread_local}}
+
+struct HasDtor { ~HasDtor(); int x; };
+__declspec(thread) HasDtor g; // expected-error {{non-trivial destruction}} expected-note {{thread_local}}
+
+struct HasDefaultedDefaultCtor {
+  HasDefaultedDefaultCtor() = default;
+  int x;
+};
+__declspec(thread) HasDefaultedDefaultCtor h;
+
+struct HasConstexprCtor {
+  constexpr HasConstexprCtor(int x) : x(x) {}
+  int x;
+};
+__declspec(thread) HasConstexprCtor i(42);
+
+int foo() {
+  __declspec(thread) int a; // expected-error {{must have global storage}}
+  static __declspec(thread) int b;
+}
+
+extern __declspec(thread) int fwd_thread_var;
+__declspec(thread) int fwd_thread_var = 5;
+
+extern int fwd_thread_var_mismatch; // expected-note {{previous declaration}}
+__declspec(thread) int fwd_thread_var_mismatch = 5; // expected-error-re {{thread-local {{.*}} follows non-thread-local}}
+
+extern __declspec(thread) int thread_mismatch_2; // expected-note {{previous declaration}}
+int thread_mismatch_2 = 5; // expected-error-re {{non-thread-local {{.*}} follows thread-local}}
+
+typedef __declspec(thread) int tls_int_t; // expected-warning {{only applies to variables}}
diff --git a/test/SemaCXX/decltype.cpp b/test/SemaCXX/decltype.cpp
index 8de5a9c..f1900b2 100644
--- a/test/SemaCXX/decltype.cpp
+++ b/test/SemaCXX/decltype.cpp
@@ -16,6 +16,27 @@
   float &fr = f2(AC().a);
 }
 
+template <class T>
+struct Future {
+  explicit Future(T v);
+
+  template <class F>
+  auto call(F&& fn) -> decltype(fn(T())) {
+    return fn(T());
+  }
+
+  template <class B, class F>
+  auto then(F&& fn) -> decltype(call(fn))
+  {
+    return fn(T());
+  }
+};
+
+void rdar16527205() {
+  Future<int> f1(42);
+  f1.call([](int){ return Future<float>(0); });
+}
+
 namespace pr10154 {
   class A{
       A(decltype(nullptr) param);
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index 7642228..d0a0731 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -195,7 +195,7 @@
 
 struct D: B {}; // expected-warning {{has virtual functions but non-virtual destructor}}
 
-struct F final: B {}; // expected-warning {{has virtual functions but non-virtual destructor}}
+struct F final : B {};
 
 struct VB {
   virtual void foo();
diff --git a/test/SemaCXX/dllexport.cpp b/test/SemaCXX/dllexport.cpp
index 3558eef..c361c49 100644
--- a/test/SemaCXX/dllexport.cpp
+++ b/test/SemaCXX/dllexport.cpp
@@ -75,6 +75,83 @@
 
 
 //===----------------------------------------------------------------------===//
+// Variable templates
+//===----------------------------------------------------------------------===//
+#if __has_feature(cxx_variable_templates)
+
+// Export declaration.
+template<typename T> __declspec(dllexport) extern int ExternVarTmplDecl;
+
+// dllexport implies a definition.
+template<typename T> __declspec(dllexport) int VarTmplDef;
+
+// Export definition.
+template<typename T> __declspec(dllexport) int VarTmplInit1 = 1;
+template<typename T> int __declspec(dllexport) VarTmplInit2 = 1;
+
+// Declare, then export definition.
+template<typename T> __declspec(dllexport) extern int VarTmplDeclInit;
+template<typename T>                              int VarTmplDeclInit = 1;
+
+// Redeclarations
+template<typename T> __declspec(dllexport) extern int VarTmplRedecl1;
+template<typename T> __declspec(dllexport)        int VarTmplRedecl1 = 1;
+
+template<typename T> __declspec(dllexport) extern int VarTmplRedecl2;
+template<typename T>                              int VarTmplRedecl2 = 1;
+
+template<typename T>                       extern int VarTmplRedecl3; // expected-note{{previous declaration is here}}
+template<typename T> __declspec(dllexport) extern int VarTmplRedecl3; // expected-error{{redeclaration of 'VarTmplRedecl3' cannot add 'dllexport' attribute}}
+
+// External linkage is required.
+template<typename T> __declspec(dllexport) static int StaticVarTmpl; // expected-error{{'StaticVarTmpl' must have external linkage when declared 'dllexport'}}
+template<typename T> __declspec(dllexport) Internal InternalTypeVarTmpl; // expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 'dllexport'}}
+namespace    { template<typename T> __declspec(dllexport) int InternalVarTmpl; } // expected-error{{'(anonymous namespace)::InternalVarTmpl' must have external linkage when declared 'dllexport'}}
+namespace ns { template<typename T> __declspec(dllexport) int ExternalVarTmpl = 1; }
+
+template<typename T> __declspec(dllexport) auto InternalAutoTypeVarTmpl = Internal(); // expected-error{{'InternalAutoTypeVarTmpl' must have external linkage when declared 'dllexport'}}
+template<typename T> __declspec(dllexport) auto ExternalAutoTypeVarTmpl = External();
+template External ExternalAutoTypeVarTmpl<ExplicitInst_Exported>;
+
+
+template<typename T> int VarTmpl = 1;
+template<typename T> __declspec(dllexport) int ExportedVarTmpl = 1;
+
+// Export implicit instantiation of an exported variable template.
+int useVarTmpl() { return ExportedVarTmpl<ImplicitInst_Exported>; }
+
+// Export explicit instantiation declaration of an exported variable template.
+extern template int ExportedVarTmpl<ExplicitDecl_Exported>;
+       template int ExportedVarTmpl<ExplicitDecl_Exported>;
+
+// Export explicit instantiation definition of an exported variable template.
+template __declspec(dllexport) int ExportedVarTmpl<ExplicitInst_Exported>;
+
+// Export specialization of an exported variable template.
+template<> __declspec(dllexport) int ExportedVarTmpl<ExplicitSpec_Exported>;
+template<> __declspec(dllexport) int ExportedVarTmpl<ExplicitSpec_Def_Exported> = 1;
+
+// Not exporting specialization of an exported variable template without
+// explicit dllexport.
+template<> int ExportedVarTmpl<ExplicitSpec_NotExported>;
+
+
+// Export explicit instantiation declaration of a non-exported variable template.
+extern template __declspec(dllexport) int VarTmpl<ExplicitDecl_Exported>;
+       template __declspec(dllexport) int VarTmpl<ExplicitDecl_Exported>;
+
+// Export explicit instantiation definition of a non-exported variable template.
+template __declspec(dllexport) int VarTmpl<ExplicitInst_Exported>;
+
+// Export specialization of a non-exported variable template.
+template<> __declspec(dllexport) int VarTmpl<ExplicitSpec_Exported>;
+template<> __declspec(dllexport) int VarTmpl<ExplicitSpec_Def_Exported> = 1;
+
+#endif // __has_feature(cxx_variable_templates)
+
+
+
+//===----------------------------------------------------------------------===//
 // Functions
 //===----------------------------------------------------------------------===//
 
@@ -92,10 +169,10 @@
 extern "C" __declspec(dllexport) void externC() {}
 
 // Export inline function.
-__declspec(dllexport) inline void inlineFunc1() {} // expected-warning{{'dllexport' attribute ignored}}
-inline void __attribute__((dllexport)) inlineFunc2() {} // expected-warning{{'dllexport' attribute ignored}}
+__declspec(dllexport) inline void inlineFunc1() {}
+inline void __attribute__((dllexport)) inlineFunc2() {}
 
-__declspec(dllexport) inline void inlineDecl(); // expected-warning{{'dllexport' attribute ignored}}
+__declspec(dllexport) inline void inlineDecl();
                              void inlineDecl() {}
 
 __declspec(dllexport) void inlineDef();
@@ -111,15 +188,20 @@
                       void redecl3(); // expected-note{{previous declaration is here}}
 __declspec(dllexport) void redecl3(); // expected-error{{redeclaration of 'redecl3' cannot add 'dllexport' attribute}}
 
+                      void redecl4(); // expected-note{{previous declaration is here}}
+__declspec(dllexport) inline void redecl4() {} // expected-error{{redeclaration of 'redecl4' cannot add 'dllexport' attribute}}
+
 // Friend functions
 struct FuncFriend {
   friend __declspec(dllexport) void friend1();
   friend __declspec(dllexport) void friend2();
   friend                       void friend3(); // expected-note{{previous declaration is here}}
+  friend                       void friend4(); // expected-note{{previous declaration is here}}
 };
 __declspec(dllexport) void friend1() {}
                       void friend2() {}
 __declspec(dllexport) void friend3() {} // expected-error{{redeclaration of 'friend3' cannot add 'dllexport' attribute}}
+__declspec(dllexport) inline void friend4() {} // expected-error{{redeclaration of 'friend4' cannot add 'dllexport' attribute}}
 
 // Implicit declarations can be redeclared with dllexport.
 __declspec(dllexport) void* operator new(__SIZE_TYPE__ n);
@@ -143,6 +225,16 @@
 // Export function template definition.
 template<typename T> __declspec(dllexport) void funcTmplDef() {}
 
+// Export inline function template.
+template<typename T> __declspec(dllexport) inline void inlineFuncTmpl1() {}
+template<typename T> inline void __attribute__((dllexport)) inlineFuncTmpl2() {}
+
+template<typename T> __declspec(dllexport) inline void inlineFuncTmplDecl();
+template<typename T>                              void inlineFuncTmplDecl() {}
+
+template<typename T> __declspec(dllexport) void inlineFuncTmplDef();
+template<typename T>                inline void inlineFuncTmplDef() {}
+
 // Redeclarations
 template<typename T> __declspec(dllexport) void funcTmplRedecl1();
 template<typename T> __declspec(dllexport) void funcTmplRedecl1() {}
@@ -153,15 +245,20 @@
 template<typename T>                       void funcTmplRedecl3(); // expected-note{{previous declaration is here}}
 template<typename T> __declspec(dllexport) void funcTmplRedecl3(); // expected-error{{redeclaration of 'funcTmplRedecl3' cannot add 'dllexport' attribute}}
 
+template<typename T>                       void funcTmplRedecl4(); // expected-note{{previous declaration is here}}
+template<typename T> __declspec(dllexport) inline void funcTmplRedecl4() {} // expected-error{{redeclaration of 'funcTmplRedecl4' cannot add 'dllexport' attribute}}
+
 // Function template friends
 struct FuncTmplFriend {
   template<typename T> friend __declspec(dllexport) void funcTmplFriend1();
   template<typename T> friend __declspec(dllexport) void funcTmplFriend2();
   template<typename T> friend                       void funcTmplFriend3(); // expected-note{{previous declaration is here}}
+  template<typename T> friend                       void funcTmplFriend4(); // expected-note{{previous declaration is here}}
 };
 template<typename T> __declspec(dllexport) void funcTmplFriend1() {}
 template<typename T>                       void funcTmplFriend2() {}
 template<typename T> __declspec(dllexport) void funcTmplFriend3() {} // expected-error{{redeclaration of 'funcTmplFriend3' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void funcTmplFriend4() {} // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllexport' attribute}}
 
 // External linkage is required.
 template<typename T> __declspec(dllexport) static int staticFuncTmpl(); // expected-error{{'staticFuncTmpl' must have external linkage when declared 'dllexport'}}
@@ -188,7 +285,7 @@
 // Export specialization of an exported function template.
 template<> __declspec(dllexport) void exportedFuncTmpl<ExplicitSpec_Exported>();
 template<> __declspec(dllexport) void exportedFuncTmpl<ExplicitSpec_Def_Exported>() {}
-template<> __declspec(dllexport) inline void exportedFuncTmpl<ExplicitSpec_InlineDef_Exported>() {} // expected-warning{{'dllexport' attribute ignored}}
+template<> __declspec(dllexport) inline void exportedFuncTmpl<ExplicitSpec_InlineDef_Exported>() {}
 
 // Not exporting specialization of an exported function template without
 // explicit dllexport.
@@ -205,7 +302,7 @@
 // Export specialization of a non-exported function template.
 template<> __declspec(dllexport) void funcTmpl<ExplicitSpec_Exported>();
 template<> __declspec(dllexport) void funcTmpl<ExplicitSpec_Def_Exported>() {}
-template<> __declspec(dllexport) inline void funcTmpl<ExplicitSpec_InlineDef_Exported>() {} // expected-warning{{'dllexport' attribute ignored}}
+template<> __declspec(dllexport) inline void funcTmpl<ExplicitSpec_InlineDef_Exported>() {}
 
 
 
@@ -249,3 +346,391 @@
 
 void __declspec(dllexport) precedenceRedecl2();
 void __declspec(dllimport) precedenceRedecl2() {} // expected-warning{{'dllimport' attribute ignored}}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class members
+//===----------------------------------------------------------------------===//
+
+// Export individual members of a class.
+struct ExportMembers {
+  struct Nested {
+    __declspec(dllexport) void normalDef();
+  };
+
+  __declspec(dllexport)                void normalDecl();
+  __declspec(dllexport)                void normalDef();
+  __declspec(dllexport)                void normalInclass() {}
+  __declspec(dllexport)                void normalInlineDef();
+  __declspec(dllexport)         inline void normalInlineDecl();
+  __declspec(dllexport) virtual        void virtualDecl();
+  __declspec(dllexport) virtual        void virtualDef();
+  __declspec(dllexport) virtual        void virtualInclass() {}
+  __declspec(dllexport) virtual        void virtualInlineDef();
+  __declspec(dllexport) virtual inline void virtualInlineDecl();
+  __declspec(dllexport) static         void staticDecl();
+  __declspec(dllexport) static         void staticDef();
+  __declspec(dllexport) static         void staticInclass() {}
+  __declspec(dllexport) static         void staticInlineDef();
+  __declspec(dllexport) static  inline void staticInlineDecl();
+
+protected:
+  __declspec(dllexport)                void protectedDef();
+private:
+  __declspec(dllexport)                void privateDef();
+};
+
+       void ExportMembers::Nested::normalDef() {}
+       void ExportMembers::normalDef() {}
+inline void ExportMembers::normalInlineDef() {}
+       void ExportMembers::normalInlineDecl() {}
+       void ExportMembers::virtualDef() {}
+inline void ExportMembers::virtualInlineDef() {}
+       void ExportMembers::virtualInlineDecl() {}
+       void ExportMembers::staticDef() {}
+inline void ExportMembers::staticInlineDef() {}
+       void ExportMembers::staticInlineDecl() {}
+       void ExportMembers::protectedDef() {}
+       void ExportMembers::privateDef() {}
+
+
+// Export on member definitions.
+struct ExportMemberDefs {
+  __declspec(dllexport)                void normalDef();
+  __declspec(dllexport)                void normalInlineDef();
+  __declspec(dllexport)         inline void normalInlineDecl();
+  __declspec(dllexport) virtual        void virtualDef();
+  __declspec(dllexport) virtual        void virtualInlineDef();
+  __declspec(dllexport) virtual inline void virtualInlineDecl();
+  __declspec(dllexport) static         void staticDef();
+  __declspec(dllexport) static         void staticInlineDef();
+  __declspec(dllexport) static  inline void staticInlineDecl();
+};
+
+__declspec(dllexport)        void ExportMemberDefs::normalDef() {}
+__declspec(dllexport) inline void ExportMemberDefs::normalInlineDef() {}
+__declspec(dllexport)        void ExportMemberDefs::normalInlineDecl() {}
+__declspec(dllexport)        void ExportMemberDefs::virtualDef() {}
+__declspec(dllexport) inline void ExportMemberDefs::virtualInlineDef() {}
+__declspec(dllexport)        void ExportMemberDefs::virtualInlineDecl() {}
+__declspec(dllexport)        void ExportMemberDefs::staticDef() {}
+__declspec(dllexport) inline void ExportMemberDefs::staticInlineDef() {}
+__declspec(dllexport)        void ExportMemberDefs::staticInlineDecl() {}
+
+
+// Export special member functions.
+struct ExportSpecials {
+  __declspec(dllexport) ExportSpecials() {}
+  __declspec(dllexport) ~ExportSpecials();
+  __declspec(dllexport) inline ExportSpecials(const ExportSpecials&);
+  __declspec(dllexport) ExportSpecials& operator=(const ExportSpecials&);
+  __declspec(dllexport) ExportSpecials(ExportSpecials&&);
+  __declspec(dllexport) ExportSpecials& operator=(ExportSpecials&&);
+};
+
+ExportSpecials::~ExportSpecials() {}
+ExportSpecials::ExportSpecials(const ExportSpecials&) {}
+inline ExportSpecials& ExportSpecials::operator=(const ExportSpecials&) { return *this; }
+ExportSpecials::ExportSpecials(ExportSpecials&&) {}
+ExportSpecials& ExportSpecials::operator=(ExportSpecials&&) { return *this; }
+
+
+// Export allocation functions.
+extern "C" void* malloc(__SIZE_TYPE__ size);
+extern "C" void free(void* p);
+struct ExportAlloc {
+  __declspec(dllexport) void* operator new(__SIZE_TYPE__);
+  __declspec(dllexport) void* operator new[](__SIZE_TYPE__);
+  __declspec(dllexport) void operator delete(void*);
+  __declspec(dllexport) void operator delete[](void*);
+};
+void* ExportAlloc::operator new(__SIZE_TYPE__ n) { return malloc(n); }
+void* ExportAlloc::operator new[](__SIZE_TYPE__ n) { return malloc(n); }
+void ExportAlloc::operator delete(void* p) { free(p); }
+void ExportAlloc::operator delete[](void* p) { free(p); }
+
+
+// Export defaulted member functions.
+struct ExportDefaulted {
+  __declspec(dllexport) ExportDefaulted() = default;
+  __declspec(dllexport) ~ExportDefaulted() = default;
+  __declspec(dllexport) ExportDefaulted(const ExportDefaulted&) = default;
+  __declspec(dllexport) ExportDefaulted& operator=(const ExportDefaulted&) = default;
+  __declspec(dllexport) ExportDefaulted(ExportDefaulted&&) = default;
+  __declspec(dllexport) ExportDefaulted& operator=(ExportDefaulted&&) = default;
+};
+
+
+// Export defaulted member function definitions.
+struct ExportDefaultedDefs {
+  __declspec(dllexport) ExportDefaultedDefs();
+  __declspec(dllexport) ~ExportDefaultedDefs();
+
+  __declspec(dllexport) inline ExportDefaultedDefs(const ExportDefaultedDefs&);
+  __declspec(dllexport) ExportDefaultedDefs& operator=(const ExportDefaultedDefs&);
+
+  __declspec(dllexport) ExportDefaultedDefs(ExportDefaultedDefs&&);
+  __declspec(dllexport) ExportDefaultedDefs& operator=(ExportDefaultedDefs&&);
+};
+
+// Export definitions.
+__declspec(dllexport) ExportDefaultedDefs::ExportDefaultedDefs() = default;
+ExportDefaultedDefs::~ExportDefaultedDefs() = default;
+
+// Export inline declaration and definition.
+__declspec(dllexport) ExportDefaultedDefs::ExportDefaultedDefs(const ExportDefaultedDefs&) = default;
+inline ExportDefaultedDefs& ExportDefaultedDefs::operator=(const ExportDefaultedDefs&) = default;
+
+__declspec(dllexport) ExportDefaultedDefs::ExportDefaultedDefs(ExportDefaultedDefs&&) = default;
+ExportDefaultedDefs& ExportDefaultedDefs::operator=(ExportDefaultedDefs&&) = default;
+
+
+// Redeclarations cannot add dllexport.
+struct MemberRedecl {
+                 void normalDef();         // expected-note{{previous declaration is here}}
+                 void normalInlineDef();   // expected-note{{previous declaration is here}}
+          inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  virtual        void virtualDef();        // expected-note{{previous declaration is here}}
+  virtual        void virtualInlineDef();  // expected-note{{previous declaration is here}}
+  virtual inline void virtualInlineDecl(); // expected-note{{previous declaration is here}}
+  static         void staticDef();         // expected-note{{previous declaration is here}}
+  static         void staticInlineDef();   // expected-note{{previous declaration is here}}
+  static  inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+__declspec(dllexport)        void MemberRedecl::normalDef() {}         // expected-error{{redeclaration of 'MemberRedecl::normalDef' cannot add 'dllexport' attribute}}
+__declspec(dllexport) inline void MemberRedecl::normalInlineDef() {}   // expected-error{{redeclaration of 'MemberRedecl::normalInlineDef' cannot add 'dllexport' attribute}}
+__declspec(dllexport)        void MemberRedecl::normalInlineDecl() {}  // expected-error{{redeclaration of 'MemberRedecl::normalInlineDecl' cannot add 'dllexport' attribute}}
+__declspec(dllexport)        void MemberRedecl::virtualDef() {}        // expected-error{{redeclaration of 'MemberRedecl::virtualDef' cannot add 'dllexport' attribute}}
+__declspec(dllexport) inline void MemberRedecl::virtualInlineDef() {}  // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDef' cannot add 'dllexport' attribute}}
+__declspec(dllexport)        void MemberRedecl::virtualInlineDecl() {} // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDecl' cannot add 'dllexport' attribute}}
+__declspec(dllexport)        void MemberRedecl::staticDef() {}         // expected-error{{redeclaration of 'MemberRedecl::staticDef' cannot add 'dllexport' attribute}}
+__declspec(dllexport) inline void MemberRedecl::staticInlineDef() {}   // expected-error{{redeclaration of 'MemberRedecl::staticInlineDef' cannot add 'dllexport' attribute}}
+__declspec(dllexport)        void MemberRedecl::staticInlineDecl() {}  // expected-error{{redeclaration of 'MemberRedecl::staticInlineDecl' cannot add 'dllexport' attribute}}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class member templates
+//===----------------------------------------------------------------------===//
+
+struct ExportMemberTmpl {
+  template<typename T> __declspec(dllexport)               void normalDecl();
+  template<typename T> __declspec(dllexport)               void normalDef();
+  template<typename T> __declspec(dllexport)               void normalInclass() {}
+  template<typename T> __declspec(dllexport)               void normalInlineDef();
+  template<typename T> __declspec(dllexport)        inline void normalInlineDecl();
+  template<typename T> __declspec(dllexport) static        void staticDecl();
+  template<typename T> __declspec(dllexport) static        void staticDef();
+  template<typename T> __declspec(dllexport) static        void staticInclass() {}
+  template<typename T> __declspec(dllexport) static        void staticInlineDef();
+  template<typename T> __declspec(dllexport) static inline void staticInlineDecl();
+};
+
+template<typename T>        void ExportMemberTmpl::normalDef() {}
+template<typename T> inline void ExportMemberTmpl::normalInlineDef() {}
+template<typename T>        void ExportMemberTmpl::normalInlineDecl() {}
+template<typename T>        void ExportMemberTmpl::staticDef() {}
+template<typename T> inline void ExportMemberTmpl::staticInlineDef() {}
+template<typename T>        void ExportMemberTmpl::staticInlineDecl() {}
+
+
+
+// Redeclarations cannot add dllexport.
+struct MemTmplRedecl {
+  template<typename T>               void normalDef();         // expected-note{{previous declaration is here}}
+  template<typename T>               void normalInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename T>        inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  template<typename T> static        void staticDef();         // expected-note{{previous declaration is here}}
+  template<typename T> static        void staticInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename T> static inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+template<typename T> __declspec(dllexport)        void MemTmplRedecl::normalDef() {}        // expected-error{{redeclaration of 'MemTmplRedecl::normalDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void MemTmplRedecl::normalInlineDef() {}  // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void MemTmplRedecl::normalInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDecl' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void MemTmplRedecl::staticDef() {}        // expected-error{{redeclaration of 'MemTmplRedecl::staticDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void MemTmplRedecl::staticInlineDef() {}  // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void MemTmplRedecl::staticInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDecl' cannot add 'dllexport' attribute}}
+
+
+
+struct MemFunTmpl {
+  template<typename T>                              void normalDef() {}
+  template<typename T> __declspec(dllexport)        void exportedNormal() {}
+  template<typename T>                       static void staticDef() {}
+  template<typename T> __declspec(dllexport) static void exportedStatic() {}
+};
+
+// Export implicit instantiation of an exported member function template.
+void useMemFunTmpl() {
+  MemFunTmpl().exportedNormal<ImplicitInst_Exported>();
+  MemFunTmpl().exportedStatic<ImplicitInst_Exported>();
+}
+
+// Export explicit instantiation declaration of an exported member function
+// template.
+extern template void MemFunTmpl::exportedNormal<ExplicitDecl_Exported>();
+       template void MemFunTmpl::exportedNormal<ExplicitDecl_Exported>();
+
+extern template void MemFunTmpl::exportedStatic<ExplicitDecl_Exported>();
+       template void MemFunTmpl::exportedStatic<ExplicitDecl_Exported>();
+
+// Export explicit instantiation definition of an exported member function
+// template.
+template void MemFunTmpl::exportedNormal<ExplicitInst_Exported>();
+template void MemFunTmpl::exportedStatic<ExplicitInst_Exported>();
+
+// Export specialization of an exported member function template.
+template<> __declspec(dllexport) void MemFunTmpl::exportedNormal<ExplicitSpec_Exported>();
+template<> __declspec(dllexport) void MemFunTmpl::exportedNormal<ExplicitSpec_Def_Exported>() {}
+template<> __declspec(dllexport) inline void MemFunTmpl::exportedNormal<ExplicitSpec_InlineDef_Exported>() {}
+
+template<> __declspec(dllexport) void MemFunTmpl::exportedStatic<ExplicitSpec_Exported>();
+template<> __declspec(dllexport) void MemFunTmpl::exportedStatic<ExplicitSpec_Def_Exported>() {}
+template<> __declspec(dllexport) inline void MemFunTmpl::exportedStatic<ExplicitSpec_InlineDef_Exported>() {}
+
+// Not exporting specialization of an exported member function template without
+// explicit dllexport.
+template<> void MemFunTmpl::exportedNormal<ExplicitSpec_NotExported>() {}
+template<> void MemFunTmpl::exportedStatic<ExplicitSpec_NotExported>() {}
+
+
+// Export explicit instantiation declaration of a non-exported member function
+// template.
+extern template __declspec(dllexport) void MemFunTmpl::normalDef<ExplicitDecl_Exported>();
+       template __declspec(dllexport) void MemFunTmpl::normalDef<ExplicitDecl_Exported>();
+
+extern template __declspec(dllexport) void MemFunTmpl::staticDef<ExplicitDecl_Exported>();
+       template __declspec(dllexport) void MemFunTmpl::staticDef<ExplicitDecl_Exported>();
+
+// Export explicit instantiation definition of a non-exported member function
+// template.
+template __declspec(dllexport) void MemFunTmpl::normalDef<ExplicitInst_Exported>();
+template __declspec(dllexport) void MemFunTmpl::staticDef<ExplicitInst_Exported>();
+
+// Export specialization of a non-exported member function template.
+template<> __declspec(dllexport) void MemFunTmpl::normalDef<ExplicitSpec_Exported>();
+template<> __declspec(dllexport) void MemFunTmpl::normalDef<ExplicitSpec_Def_Exported>() {}
+template<> __declspec(dllexport) inline void MemFunTmpl::normalDef<ExplicitSpec_InlineDef_Exported>() {}
+
+template<> __declspec(dllexport) void MemFunTmpl::staticDef<ExplicitSpec_Exported>();
+template<> __declspec(dllexport) void MemFunTmpl::staticDef<ExplicitSpec_Def_Exported>() {}
+template<> __declspec(dllexport) inline void MemFunTmpl::staticDef<ExplicitSpec_InlineDef_Exported>() {}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class template members
+//===----------------------------------------------------------------------===//
+
+// Export individual members of a class template.
+template<typename T>
+struct ExportClassTmplMembers {
+  __declspec(dllexport)                void normalDecl();
+  __declspec(dllexport)                void normalDef();
+  __declspec(dllexport)                void normalInclass() {}
+  __declspec(dllexport)                void normalInlineDef();
+  __declspec(dllexport)         inline void normalInlineDecl();
+  __declspec(dllexport) virtual        void virtualDecl();
+  __declspec(dllexport) virtual        void virtualDef();
+  __declspec(dllexport) virtual        void virtualInclass() {}
+  __declspec(dllexport) virtual        void virtualInlineDef();
+  __declspec(dllexport) virtual inline void virtualInlineDecl();
+  __declspec(dllexport) static         void staticDecl();
+  __declspec(dllexport) static         void staticDef();
+  __declspec(dllexport) static         void staticInclass() {}
+  __declspec(dllexport) static         void staticInlineDef();
+  __declspec(dllexport) static  inline void staticInlineDecl();
+
+protected:
+  __declspec(dllexport)                void protectedDef();
+private:
+  __declspec(dllexport)                void privateDef();
+};
+
+template<typename T>        void ExportClassTmplMembers<T>::normalDef() {}
+template<typename T> inline void ExportClassTmplMembers<T>::normalInlineDef() {}
+template<typename T>        void ExportClassTmplMembers<T>::normalInlineDecl() {}
+template<typename T>        void ExportClassTmplMembers<T>::virtualDef() {}
+template<typename T> inline void ExportClassTmplMembers<T>::virtualInlineDef() {}
+template<typename T>        void ExportClassTmplMembers<T>::virtualInlineDecl() {}
+template<typename T>        void ExportClassTmplMembers<T>::staticDef() {}
+template<typename T> inline void ExportClassTmplMembers<T>::staticInlineDef() {}
+template<typename T>        void ExportClassTmplMembers<T>::staticInlineDecl() {}
+template<typename T>        void ExportClassTmplMembers<T>::protectedDef() {}
+template<typename T>        void ExportClassTmplMembers<T>::privateDef() {}
+
+template struct ExportClassTmplMembers<ImplicitInst_Exported>;
+
+
+// Redeclarations cannot add dllexport.
+template<typename T>
+struct CTMR /*ClassTmplMemberRedecl*/ {
+                 void normalDef();         // expected-note{{previous declaration is here}}
+                 void normalInlineDef();   // expected-note{{previous declaration is here}}
+          inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  virtual        void virtualDef();        // expected-note{{previous declaration is here}}
+  virtual        void virtualInlineDef();  // expected-note{{previous declaration is here}}
+  virtual inline void virtualInlineDecl(); // expected-note{{previous declaration is here}}
+  static         void staticDef();         // expected-note{{previous declaration is here}}
+  static         void staticInlineDef();   // expected-note{{previous declaration is here}}
+  static  inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+template<typename T> __declspec(dllexport)        void CTMR<T>::normalDef() {}         // expected-error{{redeclaration of 'CTMR::normalDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void CTMR<T>::normalInlineDef() {}   // expected-error{{redeclaration of 'CTMR::normalInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void CTMR<T>::normalInlineDecl() {}  // expected-error{{redeclaration of 'CTMR::normalInlineDecl' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void CTMR<T>::virtualDef() {}        // expected-error{{redeclaration of 'CTMR::virtualDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void CTMR<T>::virtualInlineDef() {}  // expected-error{{redeclaration of 'CTMR::virtualInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void CTMR<T>::virtualInlineDecl() {} // expected-error{{redeclaration of 'CTMR::virtualInlineDecl' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void CTMR<T>::staticDef() {}         // expected-error{{redeclaration of 'CTMR::staticDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport) inline void CTMR<T>::staticInlineDef() {}   // expected-error{{redeclaration of 'CTMR::staticInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> __declspec(dllexport)        void CTMR<T>::staticInlineDecl() {}  // expected-error{{redeclaration of 'CTMR::staticInlineDecl' cannot add 'dllexport' attribute}}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class template member templates
+//===----------------------------------------------------------------------===//
+
+template<typename T>
+struct ExportClsTmplMemTmpl {
+  template<typename U> __declspec(dllexport)               void normalDecl();
+  template<typename U> __declspec(dllexport)               void normalDef();
+  template<typename U> __declspec(dllexport)               void normalInclass() {}
+  template<typename U> __declspec(dllexport)               void normalInlineDef();
+  template<typename U> __declspec(dllexport)        inline void normalInlineDecl();
+  template<typename U> __declspec(dllexport) static        void staticDecl();
+  template<typename U> __declspec(dllexport) static        void staticDef();
+  template<typename U> __declspec(dllexport) static        void staticInclass() {}
+  template<typename U> __declspec(dllexport) static        void staticInlineDef();
+  template<typename U> __declspec(dllexport) static inline void staticInlineDecl();
+};
+
+template<typename T> template<typename U>        void ExportClsTmplMemTmpl<T>::normalDef() {}
+template<typename T> template<typename U> inline void ExportClsTmplMemTmpl<T>::normalInlineDef() {}
+template<typename T> template<typename U>        void ExportClsTmplMemTmpl<T>::normalInlineDecl() {}
+template<typename T> template<typename U>        void ExportClsTmplMemTmpl<T>::staticDef() {}
+template<typename T> template<typename U> inline void ExportClsTmplMemTmpl<T>::staticInlineDef() {}
+template<typename T> template<typename U>        void ExportClsTmplMemTmpl<T>::staticInlineDecl() {}
+
+
+// Redeclarations cannot add dllexport.
+template<typename T>
+struct CTMTR /*ClassTmplMemberTmplRedecl*/ {
+  template<typename U>               void normalDef();         // expected-note{{previous declaration is here}}
+  template<typename U>               void normalInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename U>        inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  template<typename U> static        void staticDef();         // expected-note{{previous declaration is here}}
+  template<typename U> static        void staticInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename U> static inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+template<typename T> template<typename U> __declspec(dllexport)        void CTMTR<T>::normalDef() {}         // expected-error{{redeclaration of 'CTMTR::normalDef' cannot add 'dllexport' attribute}}
+template<typename T> template<typename U> __declspec(dllexport) inline void CTMTR<T>::normalInlineDef() {}   // expected-error{{redeclaration of 'CTMTR::normalInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> template<typename U> __declspec(dllexport)        void CTMTR<T>::normalInlineDecl() {}  // expected-error{{redeclaration of 'CTMTR::normalInlineDecl' cannot add 'dllexport' attribute}}
+template<typename T> template<typename U> __declspec(dllexport)        void CTMTR<T>::staticDef() {}         // expected-error{{redeclaration of 'CTMTR::staticDef' cannot add 'dllexport' attribute}}
+template<typename T> template<typename U> __declspec(dllexport) inline void CTMTR<T>::staticInlineDef() {}   // expected-error{{redeclaration of 'CTMTR::staticInlineDef' cannot add 'dllexport' attribute}}
+template<typename T> template<typename U> __declspec(dllexport)        void CTMTR<T>::staticInlineDecl() {}  // expected-error{{redeclaration of 'CTMTR::staticInlineDecl' cannot add 'dllexport' attribute}}
diff --git a/test/SemaCXX/dllimport.cpp b/test/SemaCXX/dllimport.cpp
index 95e9e7d..41f8e3c 100644
--- a/test/SemaCXX/dllimport.cpp
+++ b/test/SemaCXX/dllimport.cpp
@@ -105,6 +105,86 @@
 
 
 //===----------------------------------------------------------------------===//
+// Variable templates
+//===----------------------------------------------------------------------===//
+#if __has_feature(cxx_variable_templates)
+
+// Import declaration.
+template<typename T> __declspec(dllimport) extern int ExternVarTmplDecl;
+
+// dllimport implies a declaration.
+template<typename T> __declspec(dllimport) int VarTmplDecl;
+
+// Not allowed on definitions.
+template<typename T> __declspec(dllimport) extern int ExternVarTmplInit = 1; // expected-error{{definition of dllimport data}}
+template<typename T> __declspec(dllimport) int VarTmplInit1 = 1; // expected-error{{definition of dllimport data}}
+template<typename T> int __declspec(dllimport) VarTmplInit2 = 1; // expected-error{{definition of dllimport data}}
+
+// Declare, then reject definition.
+template<typename T> __declspec(dllimport) extern int ExternVarTmplDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+template<typename T>                              int ExternVarTmplDeclInit = 1; // expected-warning{{'ExternVarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+
+template<typename T> __declspec(dllimport) int VarTmplDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+template<typename T>                       int VarTmplDeclInit = 1; // expected-warning{{'VarTmplDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+
+// Redeclarations
+template<typename T> __declspec(dllimport) extern int VarTmplRedecl1;
+template<typename T> __declspec(dllimport) extern int VarTmplRedecl1;
+
+template<typename T> __declspec(dllimport) int VarTmplRedecl2;
+template<typename T> __declspec(dllimport) int VarTmplRedecl2;
+
+template<typename T> __declspec(dllimport) extern int VarTmplRedecl3; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+template<typename T>                       extern int VarTmplRedecl3; // expected-warning{{'VarTmplRedecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+
+template<typename T>                       extern int VarTmplRedecl4; // expected-note{{previous declaration is here}}
+template<typename T> __declspec(dllimport) extern int VarTmplRedecl4; // expected-error{{redeclaration of 'VarTmplRedecl4' cannot add 'dllimport' attribute}}
+
+// External linkage is required.
+template<typename T> __declspec(dllimport) static int StaticVarTmpl; // expected-error{{'StaticVarTmpl' must have external linkage when declared 'dllimport'}}
+template<typename T> __declspec(dllimport) Internal InternalTypeVarTmpl; // expected-error{{'InternalTypeVarTmpl' must have external linkage when declared 'dllimport'}}
+namespace    { template<typename T> __declspec(dllimport) int InternalVarTmpl; } // expected-error{{'(anonymous namespace)::InternalVarTmpl' must have external linkage when declared 'dllimport'}}
+namespace ns { template<typename T> __declspec(dllimport) int ExternalVarTmpl; }
+
+template<typename T> __declspec(dllimport) auto InternalAutoTypeVarTmpl = Internal(); // expected-error{{definition of dllimport data}} // expected-error{{'InternalAutoTypeVarTmpl' must have external linkage when declared 'dllimport'}}
+
+
+template<typename T> int VarTmpl;
+template<typename T> __declspec(dllimport) int ImportedVarTmpl;
+
+// Import implicit instantiation of an imported variable template.
+int useVarTmpl() { return ImportedVarTmpl<ImplicitInst_Imported>; }
+
+// Import explicit instantiation declaration of an imported variable template.
+extern template int ImportedVarTmpl<ExplicitDecl_Imported>;
+
+// An explicit instantiation definition of an imported variable template cannot
+// be imported because the template must be defined which is illegal.
+
+// Import specialization of an imported variable template.
+template<> __declspec(dllimport) int ImportedVarTmpl<ExplicitSpec_Imported>;
+template<> __declspec(dllimport) int ImportedVarTmpl<ExplicitSpec_Def_Imported> = 1; // expected-error{{definition of dllimport data}}
+
+// Not importing specialization of an imported variable template without
+// explicit dllimport.
+template<> int ImportedVarTmpl<ExplicitSpec_NotImported>;
+
+
+// Import explicit instantiation declaration of a non-imported variable template.
+extern template __declspec(dllimport) int VarTmpl<ExplicitDecl_Imported>;
+
+// Import explicit instantiation definition of a non-imported variable template.
+template __declspec(dllimport) int VarTmpl<ExplicitInst_Imported>;
+
+// Import specialization of a non-imported variable template.
+template<> __declspec(dllimport) int VarTmpl<ExplicitSpec_Imported>;
+template<> __declspec(dllimport) int VarTmpl<ExplicitSpec_Def_Imported> = 1; // expected-error{{definition of dllimport data}}
+
+#endif // __has_feature(cxx_variable_templates)
+
+
+
+//===----------------------------------------------------------------------===//
 // Functions
 //===----------------------------------------------------------------------===//
 
@@ -116,14 +196,20 @@
 void __declspec(dllimport)      decl2B();
 
 // Not allowed on function definitions.
-__declspec(dllimport) void def() {} // expected-error{{'dllimport' attribute can be applied only to symbol declaration}}
+__declspec(dllimport) void def() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
 
 // extern  "C"
-extern "C" __declspec(dllexport) void externC();
+extern "C" __declspec(dllimport) void externC();
 
 // Import inline function.
-__declspec(dllimport) inline void inlineFunc1() {} // expected-warning{{'dllimport' attribute ignored}}
-inline void __attribute__((dllimport)) inlineFunc2() {} // expected-warning{{'dllimport' attribute ignored}}
+__declspec(dllimport) inline void inlineFunc1() {}
+inline void __attribute__((dllimport)) inlineFunc2() {}
+
+__declspec(dllimport) inline void inlineDecl();
+                             void inlineDecl() {}
+
+__declspec(dllimport) void inlineDef();
+               inline void inlineDef() {}
 
 // Redeclarations
 __declspec(dllimport) void redecl1();
@@ -140,17 +226,22 @@
                       void redecl4(); // expected-note{{previous declaration is here}}
 __declspec(dllimport) void redecl4(); // expected-error{{redeclaration of 'redecl4' cannot add 'dllimport' attribute}}
 
+                      void redecl5(); // expected-note{{previous declaration is here}}
+__declspec(dllimport) inline void redecl5() {} // expected-error{{redeclaration of 'redecl5' cannot add 'dllimport' attribute}}
+
 // Friend functions
 struct FuncFriend {
   friend __declspec(dllimport) void friend1();
   friend __declspec(dllimport) void friend2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
   friend __declspec(dllimport) void friend3(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
   friend                       void friend4(); // expected-note{{previous declaration is here}}
+  friend                       void friend5(); // expected-note{{previous declaration is here}}
 };
 __declspec(dllimport) void friend1();
                       void friend2(); // expected-warning{{'friend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
                       void friend3() {} // expected-warning{{'friend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
 __declspec(dllimport) void friend4(); // expected-error{{redeclaration of 'friend4' cannot add 'dllimport' attribute}}
+__declspec(dllimport) inline void friend5() {} // expected-error{{redeclaration of 'friend5' cannot add 'dllimport' attribute}}
 
 // Implicit declarations can be redeclared with dllimport.
 __declspec(dllimport) void* operator new(__SIZE_TYPE__ n);
@@ -171,6 +262,19 @@
 template<typename T> __declspec(dllimport) void funcTmplDecl1();
 template<typename T> void __declspec(dllimport) funcTmplDecl2();
 
+// Import function template definition.
+template<typename T> __declspec(dllimport) void funcTmplDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
+
+// Import inline function template.
+template<typename T> __declspec(dllimport) inline void inlineFuncTmpl1() {}
+template<typename T> inline void __attribute__((dllimport)) inlineFuncTmpl2() {}
+
+template<typename T> __declspec(dllimport) inline void inlineFuncTmplDecl();
+template<typename T>                              void inlineFuncTmplDecl() {}
+
+template<typename T> __declspec(dllimport) void inlineFuncTmplDef();
+template<typename T>                inline void inlineFuncTmplDef() {}
+
 // Redeclarations
 template<typename T> __declspec(dllimport) void funcTmplRedecl1();
 template<typename T> __declspec(dllimport) void funcTmplRedecl1();
@@ -184,17 +288,22 @@
 template<typename T>                       void funcTmplRedecl4(); // expected-note{{previous declaration is here}}
 template<typename T> __declspec(dllimport) void funcTmplRedecl4(); // expected-error{{redeclaration of 'funcTmplRedecl4' cannot add 'dllimport' attribute}}
 
+template<typename T>                       void funcTmplRedecl5(); // expected-note{{previous declaration is here}}
+template<typename T> __declspec(dllimport) inline void funcTmplRedecl5() {} // expected-error{{redeclaration of 'funcTmplRedecl5' cannot add 'dllimport' attribute}}
+
 // Function template friends
 struct FuncTmplFriend {
   template<typename T> friend __declspec(dllimport) void funcTmplFriend1();
   template<typename T> friend __declspec(dllimport) void funcTmplFriend2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
   template<typename T> friend __declspec(dllimport) void funcTmplFriend3(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
   template<typename T> friend                       void funcTmplFriend4(); // expected-note{{previous declaration is here}}
+  template<typename T> friend __declspec(dllimport) inline void funcTmplFriend5();
 };
 template<typename T> __declspec(dllimport) void funcTmplFriend1();
 template<typename T>                       void funcTmplFriend2(); // expected-warning{{'funcTmplFriend2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
 template<typename T>                       void funcTmplFriend3() {} // expected-warning{{'funcTmplFriend3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
 template<typename T> __declspec(dllimport) void funcTmplFriend4(); // expected-error{{redeclaration of 'funcTmplFriend4' cannot add 'dllimport' attribute}}
+template<typename T>                       inline void funcTmplFriend5() {}
 
 // External linkage is required.
 template<typename T> __declspec(dllimport) static int staticFuncTmpl(); // expected-error{{'staticFuncTmpl' must have external linkage when declared 'dllimport'}}
@@ -204,13 +313,27 @@
 
 
 template<typename T> void funcTmpl() {}
-template<typename T> __declspec(dllimport) void importedFuncTmpl();
+template<typename T> inline void inlineFuncTmpl() {}
+template<typename T> __declspec(dllimport) void importedFuncTmplDecl();
+template<typename T> __declspec(dllimport) inline void importedFuncTmpl() {}
+
+// Import implicit instantiation of an imported function template.
+void useFunTmplDecl() { importedFuncTmplDecl<ImplicitInst_Imported>(); }
+void useFunTmplDef() { importedFuncTmpl<ImplicitInst_Imported>(); }
+
+// Import explicit instantiation declaration of an imported function template.
+extern template void importedFuncTmpl<ExplicitDecl_Imported>();
+
+// Import explicit instantiation definition of an imported function template.
+// NB: MSVC fails this instantiation without explicit dllimport which is most
+// likely a bug because an implicit instantiation is accepted.
+template void importedFuncTmpl<ExplicitInst_Imported>();
 
 // Import specialization of an imported function template. A definition must be
 // declared inline.
 template<> __declspec(dllimport) void importedFuncTmpl<ExplicitSpec_Imported>();
-template<> __declspec(dllimport) void importedFuncTmpl<ExplicitSpec_Def_Imported>() {} // expected-error{{'dllimport' attribute can be applied only to symbol declaration}}
-template<> __declspec(dllimport) inline void importedFuncTmpl<ExplicitSpec_InlineDef_Imported>() {} // expected-warning{{'dllimport' attribute ignored}}
+template<> __declspec(dllimport) void importedFuncTmpl<ExplicitSpec_Def_Imported>() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
+template<> __declspec(dllimport) inline void importedFuncTmpl<ExplicitSpec_InlineDef_Imported>() {}
 
 // Not importing specialization of an imported function template without
 // explicit dllimport.
@@ -219,9 +342,405 @@
 
 // Import explicit instantiation declaration of a non-imported function template.
 extern template __declspec(dllimport) void funcTmpl<ExplicitDecl_Imported>();
+extern template __declspec(dllimport) void inlineFuncTmpl<ExplicitDecl_Imported>();
+
+// Import explicit instantiation definition of a non-imported function template.
+template __declspec(dllimport) void funcTmpl<ExplicitInst_Imported>();
+template __declspec(dllimport) void inlineFuncTmpl<ExplicitInst_Imported>();
 
 // Import specialization of a non-imported function template. A definition must
 // be declared inline.
 template<> __declspec(dllimport) void funcTmpl<ExplicitSpec_Imported>();
-template<> __declspec(dllimport) void funcTmpl<ExplicitSpec_Def_Imported>() {} // expected-error{{'dllimport' attribute can be applied only to symbol declaration}}
-template<> __declspec(dllimport) inline void funcTmpl<ExplicitSpec_InlineDef_Imported>() {} // expected-warning{{'dllimport' attribute ignored}}
+template<> __declspec(dllimport) void funcTmpl<ExplicitSpec_Def_Imported>() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
+template<> __declspec(dllimport) inline void funcTmpl<ExplicitSpec_InlineDef_Imported>() {}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class members
+//===----------------------------------------------------------------------===//
+
+// Import individual members of a class.
+struct ImportMembers {
+  struct Nested {
+    __declspec(dllimport) void normalDecl();
+    __declspec(dllimport) void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  };
+
+  __declspec(dllimport)                void normalDecl();
+  __declspec(dllimport)                void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  __declspec(dllimport)                void normalInclass() {}
+  __declspec(dllimport)                void normalInlineDef();
+  __declspec(dllimport)         inline void normalInlineDecl();
+  __declspec(dllimport) virtual        void virtualDecl();
+  __declspec(dllimport) virtual        void virtualDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  __declspec(dllimport) virtual        void virtualInclass() {}
+  __declspec(dllimport) virtual        void virtualInlineDef();
+  __declspec(dllimport) virtual inline void virtualInlineDecl();
+  __declspec(dllimport) static         void staticDecl();
+  __declspec(dllimport) static         void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  __declspec(dllimport) static         void staticInclass() {}
+  __declspec(dllimport) static         void staticInlineDef();
+  __declspec(dllimport) static  inline void staticInlineDecl();
+
+protected:
+  __declspec(dllimport)                void protectedDecl();
+private:
+  __declspec(dllimport)                void privateDecl();
+};
+
+       void ImportMembers::Nested::normalDef() {} // expected-warning{{'ImportMembers::Nested::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+       void ImportMembers::normalDef() {} // expected-warning{{'ImportMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+inline void ImportMembers::normalInlineDef() {}
+       void ImportMembers::normalInlineDecl() {}
+       void ImportMembers::virtualDef() {} // expected-warning{{'ImportMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+inline void ImportMembers::virtualInlineDef() {}
+       void ImportMembers::virtualInlineDecl() {}
+       void ImportMembers::staticDef() {} // expected-warning{{'ImportMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+inline void ImportMembers::staticInlineDef() {}
+       void ImportMembers::staticInlineDecl() {}
+
+
+// Import on member definitions.
+struct ImportMemberDefs {
+  __declspec(dllimport)                void normalDef();
+  __declspec(dllimport)                void normalInlineDef();
+  __declspec(dllimport)         inline void normalInlineDecl();
+  __declspec(dllimport) virtual        void virtualDef();
+  __declspec(dllimport) virtual        void virtualInlineDef();
+  __declspec(dllimport) virtual inline void virtualInlineDecl();
+  __declspec(dllimport) static         void staticDef();
+  __declspec(dllimport) static         void staticInlineDef();
+  __declspec(dllimport) static  inline void staticInlineDecl();
+};
+
+__declspec(dllimport)        void ImportMemberDefs::normalDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
+__declspec(dllimport) inline void ImportMemberDefs::normalInlineDef() {}
+__declspec(dllimport)        void ImportMemberDefs::normalInlineDecl() {}
+__declspec(dllimport)        void ImportMemberDefs::virtualDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
+__declspec(dllimport) inline void ImportMemberDefs::virtualInlineDef() {}
+__declspec(dllimport)        void ImportMemberDefs::virtualInlineDecl() {}
+__declspec(dllimport)        void ImportMemberDefs::staticDef() {} // expected-error{{dllimport cannot be applied to non-inline function definition}}
+__declspec(dllimport) inline void ImportMemberDefs::staticInlineDef() {}
+__declspec(dllimport)        void ImportMemberDefs::staticInlineDecl() {}
+
+
+// Import special member functions.
+struct ImportSpecials {
+  __declspec(dllimport) ImportSpecials();
+  __declspec(dllimport) ~ImportSpecials();
+  __declspec(dllimport) ImportSpecials(const ImportSpecials&);
+  __declspec(dllimport) ImportSpecials& operator=(const ImportSpecials&);
+  __declspec(dllimport) ImportSpecials(ImportSpecials&&);
+  __declspec(dllimport) ImportSpecials& operator=(ImportSpecials&&);
+};
+
+
+// Import allocation functions.
+struct ImportAlloc {
+  __declspec(dllimport) void* operator new(__SIZE_TYPE__);
+  __declspec(dllimport) void* operator new[](__SIZE_TYPE__);
+  __declspec(dllimport) void operator delete(void*);
+  __declspec(dllimport) void operator delete[](void*);
+};
+
+
+// Import defaulted member functions.
+struct ImportDefaulted {
+  __declspec(dllimport) ImportDefaulted() = default;
+  __declspec(dllimport) ~ImportDefaulted() = default;
+  __declspec(dllimport) ImportDefaulted(const ImportDefaulted&) = default;
+  __declspec(dllimport) ImportDefaulted& operator=(const ImportDefaulted&) = default;
+  __declspec(dllimport) ImportDefaulted(ImportDefaulted&&) = default;
+  __declspec(dllimport) ImportDefaulted& operator=(ImportDefaulted&&) = default;
+};
+
+
+// Import defaulted member function definitions.
+struct ImportDefaultedDefs {
+  __declspec(dllimport) ImportDefaultedDefs();
+  __declspec(dllimport) ~ImportDefaultedDefs(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+
+  __declspec(dllimport) inline ImportDefaultedDefs(const ImportDefaultedDefs&);
+  __declspec(dllimport) ImportDefaultedDefs& operator=(const ImportDefaultedDefs&);
+
+  __declspec(dllimport) ImportDefaultedDefs(ImportDefaultedDefs&&);
+  __declspec(dllimport) ImportDefaultedDefs& operator=(ImportDefaultedDefs&&); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+};
+
+// Not allowed on definitions.
+__declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs() = default; // expected-error{{dllimport cannot be applied to non-inline function definition}}
+
+// dllimport cannot be dropped.
+ImportDefaultedDefs::~ImportDefaultedDefs() = default; // expected-warning{{'ImportDefaultedDefs::~ImportDefaultedDefs' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+
+// Import inline declaration and definition.
+__declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(const ImportDefaultedDefs&) = default;
+inline ImportDefaultedDefs& ImportDefaultedDefs::operator=(const ImportDefaultedDefs&) = default;
+
+__declspec(dllimport) ImportDefaultedDefs::ImportDefaultedDefs(ImportDefaultedDefs&&) = default; // expected-error{{dllimport cannot be applied to non-inline function definition}}
+ImportDefaultedDefs& ImportDefaultedDefs::operator=(ImportDefaultedDefs&&) = default; // expected-warning{{'ImportDefaultedDefs::operator=' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+
+
+// Redeclarations cannot add dllimport.
+struct MemberRedecl {
+                 void normalDef();         // expected-note{{previous declaration is here}}
+                 void normalInlineDef();   // expected-note{{previous declaration is here}}
+          inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  virtual        void virtualDef();        // expected-note{{previous declaration is here}}
+  virtual        void virtualInlineDef();  // expected-note{{previous declaration is here}}
+  virtual inline void virtualInlineDecl(); // expected-note{{previous declaration is here}}
+  static         void staticDef();         // expected-note{{previous declaration is here}}
+  static         void staticInlineDef();   // expected-note{{previous declaration is here}}
+  static  inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+__declspec(dllimport)        void MemberRedecl::normalDef() {}         // expected-error{{redeclaration of 'MemberRedecl::normalDef' cannot add 'dllimport' attribute}}
+                                                                       // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+__declspec(dllimport) inline void MemberRedecl::normalInlineDef() {}   // expected-error{{redeclaration of 'MemberRedecl::normalInlineDef' cannot add 'dllimport' attribute}}
+__declspec(dllimport)        void MemberRedecl::normalInlineDecl() {}  // expected-error{{redeclaration of 'MemberRedecl::normalInlineDecl' cannot add 'dllimport' attribute}}
+__declspec(dllimport)        void MemberRedecl::virtualDef() {}        // expected-error{{redeclaration of 'MemberRedecl::virtualDef' cannot add 'dllimport' attribute}}
+                                                                       // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+__declspec(dllimport) inline void MemberRedecl::virtualInlineDef() {}  // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDef' cannot add 'dllimport' attribute}}
+__declspec(dllimport)        void MemberRedecl::virtualInlineDecl() {} // expected-error{{redeclaration of 'MemberRedecl::virtualInlineDecl' cannot add 'dllimport' attribute}}
+__declspec(dllimport)        void MemberRedecl::staticDef() {}         // expected-error{{redeclaration of 'MemberRedecl::staticDef' cannot add 'dllimport' attribute}}
+                                                                       // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+__declspec(dllimport) inline void MemberRedecl::staticInlineDef() {}   // expected-error{{redeclaration of 'MemberRedecl::staticInlineDef' cannot add 'dllimport' attribute}}
+__declspec(dllimport)        void MemberRedecl::staticInlineDecl() {}  // expected-error{{redeclaration of 'MemberRedecl::staticInlineDecl' cannot add 'dllimport' attribute}}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class member templates
+//===----------------------------------------------------------------------===//
+
+struct ImportMemberTmpl {
+  template<typename T> __declspec(dllimport)               void normalDecl();
+  template<typename T> __declspec(dllimport)               void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  template<typename T> __declspec(dllimport)               void normalInclass() {}
+  template<typename T> __declspec(dllimport)               void normalInlineDef();
+  template<typename T> __declspec(dllimport)        inline void normalInlineDecl();
+  template<typename T> __declspec(dllimport) static        void staticDecl();
+  template<typename T> __declspec(dllimport) static        void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  template<typename T> __declspec(dllimport) static        void staticInclass() {}
+  template<typename T> __declspec(dllimport) static        void staticInlineDef();
+  template<typename T> __declspec(dllimport) static inline void staticInlineDecl();
+};
+
+template<typename T>        void ImportMemberTmpl::normalDef() {} // expected-warning{{'ImportMemberTmpl::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> inline void ImportMemberTmpl::normalInlineDef() {}
+template<typename T>        void ImportMemberTmpl::normalInlineDecl() {}
+template<typename T>        void ImportMemberTmpl::staticDef() {} // expected-warning{{'ImportMemberTmpl::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> inline void ImportMemberTmpl::staticInlineDef() {}
+template<typename T>        void ImportMemberTmpl::staticInlineDecl() {}
+
+
+// Redeclarations cannot add dllimport.
+struct MemTmplRedecl {
+  template<typename T>               void normalDef();         // expected-note{{previous declaration is here}}
+  template<typename T>               void normalInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename T>        inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  template<typename T> static        void staticDef();         // expected-note{{previous declaration is here}}
+  template<typename T> static        void staticInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename T> static inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+template<typename T> __declspec(dllimport)        void MemTmplRedecl::normalDef() {}        // expected-error{{redeclaration of 'MemTmplRedecl::normalDef' cannot add 'dllimport' attribute}}
+                                                                                            // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> __declspec(dllimport) inline void MemTmplRedecl::normalInlineDef() {}  // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void MemTmplRedecl::normalInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::normalInlineDecl' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void MemTmplRedecl::staticDef() {}        // expected-error{{redeclaration of 'MemTmplRedecl::staticDef' cannot add 'dllimport' attribute}}
+                                                                                            // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> __declspec(dllimport) inline void MemTmplRedecl::staticInlineDef() {}  // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void MemTmplRedecl::staticInlineDecl() {} // expected-error{{redeclaration of 'MemTmplRedecl::staticInlineDecl' cannot add 'dllimport' attribute}}
+
+
+
+struct MemFunTmpl {
+  template<typename T>                              void normalDef() {}
+  template<typename T> __declspec(dllimport)        void importedNormal() {}
+  template<typename T>                       static void staticDef() {}
+  template<typename T> __declspec(dllimport) static void importedStatic() {}
+};
+
+// Import implicit instantiation of an imported member function template.
+void useMemFunTmpl() {
+  MemFunTmpl().importedNormal<ImplicitInst_Imported>();
+  MemFunTmpl().importedStatic<ImplicitInst_Imported>();
+}
+
+// Import explicit instantiation declaration of an imported member function
+// template.
+extern template void MemFunTmpl::importedNormal<ExplicitDecl_Imported>();
+extern template void MemFunTmpl::importedStatic<ExplicitDecl_Imported>();
+
+// Import explicit instantiation definition of an imported member function
+// template.
+// NB: MSVC fails this instantiation without explicit dllimport.
+template void MemFunTmpl::importedNormal<ExplicitInst_Imported>();
+template void MemFunTmpl::importedStatic<ExplicitInst_Imported>();
+
+// Import specialization of an imported member function template.
+template<> __declspec(dllimport) void MemFunTmpl::importedNormal<ExplicitSpec_Imported>();
+template<> __declspec(dllimport) void MemFunTmpl::importedNormal<ExplicitSpec_Def_Imported>() {} // error on mingw
+template<> __declspec(dllimport) inline void MemFunTmpl::importedNormal<ExplicitSpec_InlineDef_Imported>() {}
+#ifndef MSABI
+// expected-error@-3{{dllimport cannot be applied to non-inline function definition}}
+#endif
+
+template<> __declspec(dllimport) void MemFunTmpl::importedStatic<ExplicitSpec_Imported>();
+template<> __declspec(dllimport) void MemFunTmpl::importedStatic<ExplicitSpec_Def_Imported>() {} // error on mingw
+template<> __declspec(dllimport) inline void MemFunTmpl::importedStatic<ExplicitSpec_InlineDef_Imported>() {}
+#ifndef MSABI
+// expected-error@-3{{dllimport cannot be applied to non-inline function definition}}
+#endif
+
+// Not importing specialization of an imported member function template without
+// explicit dllimport.
+template<> void MemFunTmpl::importedNormal<ExplicitSpec_NotImported>() {}
+template<> void MemFunTmpl::importedStatic<ExplicitSpec_NotImported>() {}
+
+
+// Import explicit instantiation declaration of a non-imported member function
+// template.
+extern template __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitDecl_Imported>();
+extern template __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitDecl_Imported>();
+
+// Import explicit instantiation definition of a non-imported member function
+// template.
+template __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitInst_Imported>();
+template __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitInst_Imported>();
+
+// Import specialization of a non-imported member function template.
+template<> __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitSpec_Imported>();
+template<> __declspec(dllimport) void MemFunTmpl::normalDef<ExplicitSpec_Def_Imported>() {} // error on mingw
+template<> __declspec(dllimport) inline void MemFunTmpl::normalDef<ExplicitSpec_InlineDef_Imported>() {}
+#ifndef MSABI
+// expected-error@-3{{dllimport cannot be applied to non-inline function definition}}
+#endif
+
+template<> __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitSpec_Imported>();
+template<> __declspec(dllimport) void MemFunTmpl::staticDef<ExplicitSpec_Def_Imported>() {} // error on mingw
+template<> __declspec(dllimport) inline void MemFunTmpl::staticDef<ExplicitSpec_InlineDef_Imported>() {}
+#ifndef MSABI
+// expected-error@-3{{dllimport cannot be applied to non-inline function definition}}
+#endif
+
+
+
+//===----------------------------------------------------------------------===//
+// Class template members
+//===----------------------------------------------------------------------===//
+
+// Import individual members of a class template.
+template<typename T>
+struct ImportClassTmplMembers {
+  __declspec(dllimport)                void normalDecl();
+  __declspec(dllimport)                void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  __declspec(dllimport)                void normalInclass() {}
+  __declspec(dllimport)                void normalInlineDef();
+  __declspec(dllimport)         inline void normalInlineDecl();
+  __declspec(dllimport) virtual        void virtualDecl();
+  __declspec(dllimport) virtual        void virtualDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  __declspec(dllimport) virtual        void virtualInclass() {}
+  __declspec(dllimport) virtual        void virtualInlineDef();
+  __declspec(dllimport) virtual inline void virtualInlineDecl();
+  __declspec(dllimport) static         void staticDecl();
+  __declspec(dllimport) static         void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  __declspec(dllimport) static         void staticInclass() {}
+  __declspec(dllimport) static         void staticInlineDef();
+  __declspec(dllimport) static  inline void staticInlineDecl();
+
+protected:
+  __declspec(dllimport)                void protectedDecl();
+private:
+  __declspec(dllimport)                void privateDecl();
+};
+
+// NB: MSVC is inconsistent here and disallows *InlineDef on class templates,
+// but allows it on classes. We allow both.
+template<typename T>        void ImportClassTmplMembers<T>::normalDef() {} // expected-warning{{'ImportClassTmplMembers::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> inline void ImportClassTmplMembers<T>::normalInlineDef() {}
+template<typename T>        void ImportClassTmplMembers<T>::normalInlineDecl() {}
+template<typename T>        void ImportClassTmplMembers<T>::virtualDef() {} // expected-warning{{'ImportClassTmplMembers::virtualDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> inline void ImportClassTmplMembers<T>::virtualInlineDef() {}
+template<typename T>        void ImportClassTmplMembers<T>::virtualInlineDecl() {}
+template<typename T>        void ImportClassTmplMembers<T>::staticDef() {} // expected-warning{{'ImportClassTmplMembers::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> inline void ImportClassTmplMembers<T>::staticInlineDef() {}
+template<typename T>        void ImportClassTmplMembers<T>::staticInlineDecl() {}
+
+
+// Redeclarations cannot add dllimport.
+template<typename T>
+struct CTMR /*ClassTmplMemberRedecl*/ {
+                 void normalDef();         // expected-note{{previous declaration is here}}
+                 void normalInlineDef();   // expected-note{{previous declaration is here}}
+          inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  virtual        void virtualDef();        // expected-note{{previous declaration is here}}
+  virtual        void virtualInlineDef();  // expected-note{{previous declaration is here}}
+  virtual inline void virtualInlineDecl(); // expected-note{{previous declaration is here}}
+  static         void staticDef();         // expected-note{{previous declaration is here}}
+  static         void staticInlineDef();   // expected-note{{previous declaration is here}}
+  static  inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+template<typename T> __declspec(dllimport)        void CTMR<T>::normalDef() {}         // expected-error{{redeclaration of 'CTMR::normalDef' cannot add 'dllimport' attribute}}
+                                                                                       // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> __declspec(dllimport) inline void CTMR<T>::normalInlineDef() {}   // expected-error{{redeclaration of 'CTMR::normalInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void CTMR<T>::normalInlineDecl() {}  // expected-error{{redeclaration of 'CTMR::normalInlineDecl' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void CTMR<T>::virtualDef() {}        // expected-error{{redeclaration of 'CTMR::virtualDef' cannot add 'dllimport' attribute}}
+                                                                                       // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> __declspec(dllimport) inline void CTMR<T>::virtualInlineDef() {}  // expected-error{{redeclaration of 'CTMR::virtualInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void CTMR<T>::virtualInlineDecl() {} // expected-error{{redeclaration of 'CTMR::virtualInlineDecl' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void CTMR<T>::staticDef() {}         // expected-error{{redeclaration of 'CTMR::staticDef' cannot add 'dllimport' attribute}}
+                                                                                       // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> __declspec(dllimport) inline void CTMR<T>::staticInlineDef() {}   // expected-error{{redeclaration of 'CTMR::staticInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> __declspec(dllimport)        void CTMR<T>::staticInlineDecl() {}  // expected-error{{redeclaration of 'CTMR::staticInlineDecl' cannot add 'dllimport' attribute}}
+
+
+
+//===----------------------------------------------------------------------===//
+// Class template member templates
+//===----------------------------------------------------------------------===//
+
+template<typename T>
+struct ImportClsTmplMemTmpl {
+  template<typename U> __declspec(dllimport)               void normalDecl();
+  template<typename U> __declspec(dllimport)               void normalDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  template<typename U> __declspec(dllimport)               void normalInclass() {}
+  template<typename U> __declspec(dllimport)               void normalInlineDef();
+  template<typename U> __declspec(dllimport)        inline void normalInlineDecl();
+  template<typename U> __declspec(dllimport) static        void staticDecl();
+  template<typename U> __declspec(dllimport) static        void staticDef(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}}
+  template<typename U> __declspec(dllimport) static        void staticInclass() {}
+  template<typename U> __declspec(dllimport) static        void staticInlineDef();
+  template<typename U> __declspec(dllimport) static inline void staticInlineDecl();
+};
+
+template<typename T> template<typename U>        void ImportClsTmplMemTmpl<T>::normalDef() {} // expected-warning{{'ImportClsTmplMemTmpl::normalDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> template<typename U> inline void ImportClsTmplMemTmpl<T>::normalInlineDef() {}
+template<typename T> template<typename U>        void ImportClsTmplMemTmpl<T>::normalInlineDecl() {}
+template<typename T> template<typename U>        void ImportClsTmplMemTmpl<T>::staticDef() {} // expected-warning{{'ImportClsTmplMemTmpl::staticDef' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}}
+template<typename T> template<typename U> inline void ImportClsTmplMemTmpl<T>::staticInlineDef() {}
+template<typename T> template<typename U>        void ImportClsTmplMemTmpl<T>::staticInlineDecl() {}
+
+
+// Redeclarations cannot add dllimport.
+template<typename T>
+struct CTMTR /*ClassTmplMemberTmplRedecl*/ {
+  template<typename U>               void normalDef();         // expected-note{{previous declaration is here}}
+  template<typename U>               void normalInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename U>        inline void normalInlineDecl();  // expected-note{{previous declaration is here}}
+  template<typename U> static        void staticDef();         // expected-note{{previous declaration is here}}
+  template<typename U> static        void staticInlineDef();   // expected-note{{previous declaration is here}}
+  template<typename U> static inline void staticInlineDecl();  // expected-note{{previous declaration is here}}
+};
+
+template<typename T> template<typename U> __declspec(dllimport)        void CTMTR<T>::normalDef() {}         // expected-error{{redeclaration of 'CTMTR::normalDef' cannot add 'dllimport' attribute}}
+                                                                                                             // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::normalInlineDef() {}   // expected-error{{redeclaration of 'CTMTR::normalInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> template<typename U> __declspec(dllimport)        void CTMTR<T>::normalInlineDecl() {}  // expected-error{{redeclaration of 'CTMTR::normalInlineDecl' cannot add 'dllimport' attribute}}
+template<typename T> template<typename U> __declspec(dllimport)        void CTMTR<T>::staticDef() {}         // expected-error{{redeclaration of 'CTMTR::staticDef' cannot add 'dllimport' attribute}}
+                                                                                                             // expected-error@-1{{dllimport cannot be applied to non-inline function definition}}
+template<typename T> template<typename U> __declspec(dllimport) inline void CTMTR<T>::staticInlineDef() {}   // expected-error{{redeclaration of 'CTMTR::staticInlineDef' cannot add 'dllimport' attribute}}
+template<typename T> template<typename U> __declspec(dllimport)        void CTMTR<T>::staticInlineDecl() {}  // expected-error{{redeclaration of 'CTMTR::staticInlineDecl' cannot add 'dllimport' attribute}}
diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp
index 1b1770a..81c5cb4 100644
--- a/test/SemaCXX/elaborated-type-specifier.cpp
+++ b/test/SemaCXX/elaborated-type-specifier.cpp
@@ -43,3 +43,12 @@
   if (s5 == s5_2) return 1; // expected-error {{comparison of distinct pointer types ('struct S5 *' and 'struct S5 *')}}
   return 0;
 }
+
+namespace test5 {
+  struct A {
+    class __attribute__((visibility("hidden"))) B {};
+
+    void test(class __attribute__((visibility("hidden"), noreturn)) B b) { // expected-warning {{'noreturn' attribute only applies to functions and methods}}
+    }
+  };
+}
diff --git a/test/SemaCXX/err_init_conversion_failed.cpp b/test/SemaCXX/err_init_conversion_failed.cpp
index 0652e7a..e31f215 100644
--- a/test/SemaCXX/err_init_conversion_failed.cpp
+++ b/test/SemaCXX/err_init_conversion_failed.cpp
@@ -43,3 +43,19 @@
   const float4 V = (float4){ in, out };
   // expected-error@-1{{cannot initialize a compound literal initializer}}
 }
+
+namespace template_test {
+class S {
+public:
+   void foo(int);
+};
+
+template <class P> struct S2 {
+  void (P::*a)(const int &);
+};
+
+void test_15() {
+  S2<S> X = {&S::foo};
+  // expected-error-re@-1{{cannot initialize a member subobject of type 'void (template_test::S::*)(const int &){{( __attribute__\(\(thiscall\)\))?}}' with an rvalue of type 'void (template_test::S::*)(int){{( __attribute__\(\(thiscall\)\))?}}': type mismatch at 1st parameter ('const int &' vs 'int')}}
+}
+}
diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp
index 25a9c84..1a50c99 100644
--- a/test/SemaCXX/expressions.cpp
+++ b/test/SemaCXX/expressions.cpp
@@ -125,3 +125,13 @@
     return (sizeof T());
   }
 }
+
+void test4() {
+  #define X 0
+  #define Y 1
+  bool r1 = X || Y;
+
+  #define Y2 2
+  bool r2 = X || Y2; // expected-warning {{use of logical '||' with constant operand}} \
+                     // expected-note {{use '|' for a bitwise operation}}
+}
diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp
index aed2ab2..0358910 100644
--- a/test/SemaCXX/friend.cpp
+++ b/test/SemaCXX/friend.cpp
@@ -288,3 +288,11 @@
     ::test10::f10_d(z);
   }
 }
+
+namespace test11 {
+  class __attribute__((visibility("hidden"))) B;
+
+  class A {
+    friend class __attribute__((visibility("hidden"), noreturn)) B; // expected-warning {{'noreturn' attribute only applies to functions and methods}}
+  };
+}
diff --git a/test/SemaCXX/funcdname.cpp b/test/SemaCXX/funcdname.cpp
new file mode 100644
index 0000000..d63d3f5
--- /dev/null
+++ b/test/SemaCXX/funcdname.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -std=c++1y -triple i386-pc-win32 -fms-compatibility -fms-extensions -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+int foo() {
+  static_assert(sizeof(__FUNCDNAME__) == 12, "?foo@@YAHXZ");
+  return 0;
+}
+
+// Within templates.
+template <typename T>
+int baz() {
+  static_assert(sizeof(__FUNCDNAME__) == 16, "??$baz@H@@YAHXZ");
+
+  return 0;
+}
+
+struct A {
+  A() {
+    static_assert(sizeof(__FUNCDNAME__) == 13, "??0A@@QAE@XZ");
+  }
+  ~A() {
+    static_assert(sizeof(__FUNCDNAME__) == 13, "??1A@@QAE@XZ");
+  }
+};
+
+int main() {
+  static_assert(sizeof(__FUNCDNAME__) == 5, "main");
+
+  baz<int>();
+
+  return 0;
+}
diff --git a/test/SemaCXX/microsoft-cxx0x.cpp b/test/SemaCXX/microsoft-cxx0x.cpp
index 79bd7c3..58ab940 100644
--- a/test/SemaCXX/microsoft-cxx0x.cpp
+++ b/test/SemaCXX/microsoft-cxx0x.cpp
@@ -6,7 +6,7 @@
      unsigned int a;
 };
 int b = 3;
-A var = {  b }; // expected-warning {{ cannot be narrowed }} expected-note {{override}}
+A var = {  b }; // expected-warning {{ cannot be narrowed }} expected-note {{insert an explicit cast to silence this issue}}
 
 
 namespace PR13433 {
diff --git a/test/SemaCXX/microsoft-new-delete.cpp b/test/SemaCXX/microsoft-new-delete.cpp
index e0d25dc..6c9be22 100644
--- a/test/SemaCXX/microsoft-new-delete.cpp
+++ b/test/SemaCXX/microsoft-new-delete.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify -std=c++11 %s
 
 #include <stddef.h>
 
@@ -10,3 +9,26 @@
   // Expect no error in MSVC compatibility mode
   int *p = new(arbitrary) int[4];
 }
+
+class noncopyable { noncopyable(const noncopyable&); } extern nc; // expected-note {{here}}
+void *operator new[](size_t, noncopyable);
+void *operator new(size_t, const noncopyable&);
+void *q = new (nc) int[4]; // expected-error {{calling a private constructor}}
+
+struct bitfield { int n : 3; } bf; // expected-note {{here}}
+void *operator new[](size_t, int &);
+void *operator new(size_t, const int &);
+void *r = new (bf.n) int[4]; // expected-error {{non-const reference cannot bind to bit-field}}
+
+struct base {};
+struct derived : private base {} der; // expected-note {{here}}
+void *operator new[](size_t, base &);
+void *operator new(size_t, derived &);
+void *s = new (der) int[4]; // expected-error {{private}}
+
+struct explicit_ctor { explicit explicit_ctor(int); };
+struct explicit_ctor_tag {} ect;
+void *operator new[](size_t, explicit_ctor_tag, explicit_ctor);
+void *operator new(size_t, explicit_ctor_tag, int);
+void *t = new (ect, 0) int[4];
+void *u = new (ect, {0}) int[4];
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 8587e70..bfbf9c4 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -8,13 +8,12 @@
     static int Ag1();
     static int Ag2();
   };
-  int ax;
+  int ax; // expected-note {{'ax' declared here}}
   void Af();
 }
 
 A:: ; // expected-error {{expected unqualified-id}}
-// FIXME: there is a member 'ax'; it's just not a class.
-::A::ax::undef ex3; // expected-error {{no member named 'ax'}}
+::A::ax::undef ex3; // expected-error {{'ax' is not a class, namespace, or scoped enumeration}}
 A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}}
 
 int A::C::Ag1() { return 0; }
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 615b10a..da28eef 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -pedantic -verify %s
 int* f(int) { return 0; }
 float* f(float) { return 0; }
 void f();
@@ -580,3 +580,13 @@
   void f(const volatile int &, int);
   void g() { f(0, 0); }
 }
+
+void test5() {
+  struct {
+    typedef void F1(int);
+    typedef void F2(double);
+    operator F1*();  // expected-note{{conversion candidate}}
+    operator F2*();  // expected-note{{conversion candidate}}
+  } callable;
+  callable();  // expected-error{{no matching function for call}}
+}
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index cd2b2d3..feb7c71 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -507,3 +507,15 @@
   // expected-note@-12 {{candidate template ignored: substitution failure}}
 } // namespace PR14995
 
+namespace ConversionVersusTemplateOrdering {
+  struct A {
+    operator short() = delete;
+    template <typename T> operator T();
+  } a;
+  struct B {
+    template <typename T> operator T();
+    operator short() = delete;
+  } b;
+  int x = a;
+  int y = b;
+}
diff --git a/test/SemaCXX/pragma-optimize.cpp b/test/SemaCXX/pragma-optimize.cpp
new file mode 100644
index 0000000..0f03b81
--- /dev/null
+++ b/test/SemaCXX/pragma-optimize.cpp
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple x86_64-unknown-linux -emit-llvm -O2 < %s | FileCheck %s
+
+#pragma clang optimize off
+
+// This is a macro definition and therefore its text is not present after
+// preprocessing. The pragma has no effect here.
+#define CREATE_FUNC(name)        \
+int name (int param) {           \
+    return param;                \
+}                                \
+
+// This is a declaration and therefore it is not decorated with `optnone`.
+extern int foo(int a, int b);
+// CHECK-DAG: @_Z3fooii{{.*}} [[ATTRFOO:#[0-9]+]]
+
+// This is a definition and therefore it will be decorated with `optnone`.
+int bar(int x, int y) {
+    for(int i = 0; i < x; ++i)
+        y += x;
+    return y + foo(x, y);
+}
+// CHECK-DAG: @_Z3barii{{.*}} [[ATTRBAR:#[0-9]+]]
+
+// The function "int created (int param)" created by the macro invocation
+// is also decorated with the `optnone` attribute because it is within a
+// region of code affected by the functionality (not because of the position
+// of the macro definition).
+CREATE_FUNC (created)
+// CHECK-DAG: @_Z7createdi{{.*}} [[ATTRCREATED:#[0-9]+]]
+
+class MyClass {
+    public:
+        // The declaration of the method is not decorated with `optnone`.
+        int method(int blah);
+};
+
+// The definition of the method instead is decorated with `optnone`.
+int MyClass::method(int blah) {
+    return blah + 1;
+}
+// CHECK-DAG: @_ZN7MyClass6methodEi{{.*}} [[ATTRMETHOD:#[0-9]+]]
+
+// A template declaration will not be decorated with `optnone`.
+template <typename T> T twice (T param);
+
+// The template definition will be decorated with the attribute `optnone`.
+template <typename T> T thrice (T param) {
+    return 3 * param;
+}
+
+// This function definition will not be decorated with `optnone` because the
+// attribute would conflict with `always_inline`.
+int __attribute__((always_inline)) baz(int z) {
+    return foo(z, 2);
+}
+// CHECK-DAG: @_Z3bazi{{.*}} [[ATTRBAZ:#[0-9]+]]
+
+#pragma clang optimize on
+
+// The function "int wombat(int param)" created by the macro is not
+// decorated with `optnone`, because the pragma applies its effects only
+// after preprocessing. The position of the macro definition is not
+// relevant.
+CREATE_FUNC (wombat)
+// CHECK-DAG: @_Z6wombati{{.*}} [[ATTRWOMBAT:#[0-9]+]]
+
+// This instantiation of the "twice" template function with a "float" type
+// will not have an `optnone` attribute because the template declaration was
+// not affected by the pragma.
+float container (float par) {
+    return twice(par);
+}
+// CHECK-DAG: @_Z9containerf{{.*}} [[ATTRCONTAINER:#[0-9]+]]
+// CHECK-DAG: @_Z5twiceIfET_S0_{{.*}} [[ATTRTWICE:#[0-9]+]]
+
+// This instantiation of the "thrice" template function with a "float" type
+// will have an `optnone` attribute because the template definition was
+// affected by the pragma.
+float container2 (float par) {
+    return thrice(par);
+}
+// CHECK-DAG: @_Z10container2f{{.*}} [[ATTRCONTAINER2:#[0-9]+]]
+// CHECK-DAG: @_Z6thriceIfET_S0_{{.*}} [[ATTRTHRICEFLOAT:#[0-9]+]]
+
+
+// A template specialization is a new definition and it will not be
+// decorated with an `optnone` attribute because it is now outside of the
+// affected region.
+template<> int thrice(int par) {
+    return (par << 1) + par;
+}
+int container3 (int par) {
+    return thrice(par);
+}
+// CHECK-DAG: @_Z10container3i{{.*}} [[ATTRCONTAINER3:#[0-9]+]]
+// CHECK-DAG: @_Z6thriceIiET_S0_{{.*}} [[ATTRTHRICEINT:#[0-9]+]]
+
+
+// Check for both noinline and optnone on each function that should have them.
+// CHECK-DAG: attributes [[ATTRBAR]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
+// CHECK-DAG: attributes [[ATTRCREATED]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
+// CHECK-DAG: attributes [[ATTRMETHOD]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
+// CHECK-DAG: attributes [[ATTRTHRICEFLOAT]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
+
+// Check that the other functions do NOT have optnone.
+// CHECK-DAG-NOT: attributes [[ATTRFOO]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRBAZ]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRWOMBAT]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRCONTAINER]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRTWICE]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRCONTAINER2]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRCONTAINER3]] = { {{.*}}optnone{{.*}} }
+// CHECK-DAG-NOT: attributes [[ATTRTHRICEINT]] = { {{.*}}optnone{{.*}} }
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp
index c5fdb09..dc15dc8 100644
--- a/test/SemaCXX/scope-check.cpp
+++ b/test/SemaCXX/scope-check.cpp
@@ -1,6 +1,18 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fcxx-exceptions %s -Wno-unreachable-code
 // RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fcxx-exceptions -std=gnu++11 %s -Wno-unreachable-code
 
+namespace testInvalid {
+Invalid inv; // expected-error {{unknown type name}}
+// Make sure this doesn't assert.
+void fn()
+{
+    int c = 0;
+    if (inv)
+Here: ;
+    goto Here;
+}
+}
+
 namespace test0 {
   struct D { ~D(); };
 
@@ -409,15 +421,23 @@
   }
 }
 
-// This test must be last, because the error prohibits further jump diagnostics.
-namespace testInvalid {
-Invalid inv; // expected-error {{unknown type name}}
-// Make sure this doesn't assert.
-void fn()
-{
-    int c = 0;
-    if (inv)
-Here: ;
-    goto Here;
-}
+namespace test_recovery {
+  // Test that jump scope checking recovers when there are unspecified errors
+  // in the function declaration or body.
+
+  void test(nexist, int c) { // expected-error {{}}
+    nexist_fn(); // expected-error {{}}
+    goto nexist_label; // expected-error {{use of undeclared label}}
+    goto a0; // expected-error {{goto into protected scope}}
+    int a = 0; // expected-note {{jump bypasses variable initialization}}
+    a0:;
+
+    switch (c) {
+    case $: // expected-error {{}}
+    case 0:
+      int x = 56; // expected-note {{jump bypasses variable initialization}}
+    case 1: // expected-error {{switch case is in protected scope}}
+      x = 10;
+    }
+  }
 }
diff --git a/test/SemaCXX/template-implicit-vars.cpp b/test/SemaCXX/template-implicit-vars.cpp
new file mode 100644
index 0000000..a8e8bf7
--- /dev/null
+++ b/test/SemaCXX/template-implicit-vars.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only %s -std=c++11 -ast-dump | FileCheck %s
+template<typename T>
+void f(T t) {
+  T a[] = {t};
+  for (auto x : a) {}
+}
+
+void g() {
+  f(1);
+}
+// CHECK: VarDecl {{.*}} implicit __range
+// CHECK: VarDecl {{.*}} implicit __range
+// CHECK: VarDecl {{.*}} implicit __begin
+// CHECK: VarDecl {{.*}} implicit __end
diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp
index 28fb8dc..3b94ef0 100644
--- a/test/SemaCXX/type-traits.cpp
+++ b/test/SemaCXX/type-traits.cpp
@@ -1964,6 +1964,10 @@
 
   { int arr[T(__is_constructible(NonPOD, int))]; }
   { int arr[F(__is_nothrow_constructible(NonPOD, int))]; }
+
+  // PR19178
+  { int arr[F(__is_constructible(Abstract))]; }
+  { int arr[F(__is_nothrow_constructible(Abstract))]; }
 }
 
 // Instantiation of __is_trivially_constructible
@@ -1991,6 +1995,7 @@
   { int arr[F((is_trivially_constructible<int, int*>::value))]; }
   { int arr[F((is_trivially_constructible<NonTrivialDefault>::value))]; }
   { int arr[F((is_trivially_constructible<ThreeArgCtor, int*, char*, int&>::value))]; }
+  { int arr[F((is_trivially_constructible<Abstract>::value))]; } // PR19178
 }
 
 void array_rank() {
diff --git a/test/SemaCXX/typo-correction-pt2.cpp b/test/SemaCXX/typo-correction-pt2.cpp
index 9943dd2..2fab22a 100644
--- a/test/SemaCXX/typo-correction-pt2.cpp
+++ b/test/SemaCXX/typo-correction-pt2.cpp
@@ -242,6 +242,28 @@
   };
   bar();  // expected-error-re {{use of undeclared identifier 'bar'{{$}}}}
 }
+
+class Thread {
+ public:
+  void Start();
+  static void Stop();  // expected-note {{'Thread::Stop' declared here}}
+};
+
+class Manager {
+ public:
+  void Start(int);  // expected-note {{'Start' declared here}}
+  void Stop(int);  // expected-note {{'Stop' declared here}}
+};
+
+void test(Manager *m) {
+  // Don't suggest Thread::Start as a correction just because it has the same
+  // (unqualified) name and accepts the right number of args; this is a method
+  // call on an object in an unrelated class.
+  m->Start();  // expected-error-re {{too few arguments to function call, expected 1, have 0{{$}}}}
+  m->Stop();  // expected-error-re {{too few arguments to function call, expected 1, have 0{{$}}}}
+  Stop();  // expected-error {{use of undeclared identifier 'Stop'; did you mean 'Thread::Stop'?}}
+}
+
 }
 
 namespace std {
diff --git a/test/SemaCXX/undefined-inline.cpp b/test/SemaCXX/undefined-inline.cpp
index ad719ae..18973ef 100644
--- a/test/SemaCXX/undefined-inline.cpp
+++ b/test/SemaCXX/undefined-inline.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -verify %s
 // PR14993
 
 namespace test1 {
@@ -55,3 +55,9 @@
   void test() { foo(); }
   inline void foo() __attribute__((gnu_inline));
 }
+
+namespace test11 {
+  inline void foo() __attribute__((dllexport));
+  inline void bar() __attribute__((dllimport));
+  void test() { foo(); bar(); }
+}
diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp
index 24d92f1..40f80a7 100644
--- a/test/SemaCXX/using-decl-1.cpp
+++ b/test/SemaCXX/using-decl-1.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 extern "C" { void f(bool); }
 
@@ -160,3 +161,97 @@
 }
 using N::M::FFF; // expected-error {{no member named 'FFF' in namespace 'using_suggestion_val_dropped_nested_specifier::N::M'; did you mean 'N::FFF'?}}
 }
+
+namespace UsingDeclVsHiddenName {
+  namespace A {
+    enum HiddenTag1 {}; // expected-note {{previous use is here}}
+    enum HiddenTag2 {}; // expected-note {{target}}
+    int HiddenFn1; // expected-note {{target}}
+    int HiddenFn2; // expected-note {{target}}
+    int HiddenLocalExtern1;
+    int HiddenLocalExtern2;
+  }
+
+  namespace B {
+    using A::HiddenTag1;
+    using A::HiddenFn1; // expected-note {{using declaration}}
+    using A::HiddenLocalExtern1;
+
+    struct S {
+      friend struct HiddenTag1; // expected-error {{tag type that does not match previous}}
+      friend struct HiddenTag2; // expected-note {{conflicting declaration}}
+      friend void HiddenFn1(); // expected-error {{cannot befriend target of using declaration}}
+      friend void HiddenFn2(); // expected-note {{conflicting declaration}}
+      void f() {
+        // OK, these are not in the scope of namespace B, even though they're
+        // members of the namespace.
+        void HiddenLocalExtern1();
+        void HiddenLocalExtern2();
+      }
+    };
+
+    using A::HiddenTag2; // expected-error {{conflicts with declaration already in scope}}
+    using A::HiddenFn2; // expected-error {{conflicts with declaration already in scope}}
+    using A::HiddenLocalExtern2;
+  }
+}
+
+namespace PR19171 {
+  struct Z {
+    Z();
+  };
+
+  typedef struct {
+    Z i;
+  } S;
+
+  struct Y : S {
+    using S::S;
+#if __cplusplus < 201103L
+    // expected-error@-2 {{no member named 'S' in 'PR19171::S'}}
+#endif
+  };
+
+  // [namespace.udecl]p3: In a using-declaration used as a member-declaration,
+  // the nested-name-specifier shall name a base class of the class being defined.
+  // If such a using-declaration names a constructor, the nested-name-specifier
+  // shall name a direct base class of the class being defined;
+
+  struct B_blah { };
+  struct C_blah : B_blah { C_blah(int); }; // expected-note 0-1{{declared here}}
+  struct D1 : C_blah {
+    // FIXME: We should be able to correct this in C++11 mode.
+    using B_blah::C_blah; // expected-error-re {{no member named 'C_blah' in 'PR19171::B_blah'{{$}}}}
+  };
+  struct D2 : C_blah {
+    // Somewhat bizarrely, this names the injected-class-name of B_blah within
+    // C_blah, and is valid.
+    using C_blah::B_blah;
+  };
+  struct D3 : C_blah {
+    using C_blah::D_blah;
+#if __cplusplus < 201103L
+    // expected-error-re@-2 {{no member named 'D_blah' in 'PR19171::C_blah'{{$}}}}
+#else
+    // expected-error@-4 {{no member named 'D_blah' in 'PR19171::C_blah'; did you mean 'C_blah'?}}
+#endif
+  };
+#if __cplusplus >= 201103L
+  D3 d3(0); // ok
+#endif
+
+  struct E { };
+  struct EE { int EE; };
+  struct F : E {
+    using E::EE; // expected-error-re {{no member named 'EE' in 'PR19171::E'{{$}}}}
+  };
+}
+
+namespace TypoCorrectTemplateMember {
+  struct A {
+    template<typename T> void foobar(T); // expected-note {{'foobar' declared here}}
+  };
+  struct B : A {
+    using A::goobar; // expected-error {{no member named 'goobar' in 'TypoCorrectTemplateMember::A'; did you mean 'foobar'?}}
+  };
+}
diff --git a/test/SemaCXX/vector-casts.cpp b/test/SemaCXX/vector-casts.cpp
index 3aa097b..2ccd597 100644
--- a/test/SemaCXX/vector-casts.cpp
+++ b/test/SemaCXX/vector-casts.cpp
@@ -23,19 +23,19 @@
   (void)reinterpret_cast<__v2si>(ll);
   (void)(__v2si)(ll);
 
-  (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'S' is not allowed}}
-  (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' to 'S'}}
-  (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' is not allowed}}
-  (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' without a conversion operator}}
+  (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' (vector of 2 'int' values) to 'S' is not allowed}}
+  (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' (vector of 2 'int' values) to 'S'}}
+  (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' (vector of 2 'int' values) is not allowed}}
+  (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' (vector of 2 'int' values) without a conversion operator}}
   
-  (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' to scalar 'unsigned char' of different size}}
-  (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' to scalar 'unsigned char' of different size}}
-  (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' of different size}}
+  (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' (vector of 2 'int' values) to scalar 'unsigned char' of different size}}
+  (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' (vector of 2 'int' values) to scalar 'unsigned char' of different size}}
+  (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' (vector of 2 'int' values) of different size}}
 
-  (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' to vector '__v8hi' of different size}}
-  (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' to vector '__v8hi' of different size}}
-  (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' to vector '__v4hi' of different size}}
-  (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' to vector '__v4hi' of different size}}
+  (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v8hi' (vector of 8 'short' values) of different size}}
+  (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v8hi' (vector of 8 'short' values) of different size}}
+  (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' (vector of 8 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
+  (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' (vector of 8 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
 }
 
 struct testvec {
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
index 7957c23..bcd7fed 100644
--- a/test/SemaCXX/vector.cpp
+++ b/test/SemaCXX/vector.cpp
@@ -24,8 +24,8 @@
   f1(ll16e); // expected-error{{call to 'f1' is ambiguous}}
 }
 
-void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' to 'char16_e' for 1st argument}} \
-       // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' for 1st argument}}
+void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) for 1st argument}} \
+       // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' (vector of 16 'char' values) for 1st argument}}
 
 void f2_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
   f2(c16);
@@ -85,7 +85,7 @@
   (void)static_cast<longlong16>(ll16);
   (void)static_cast<longlong16_e>(ll16);
   (void)static_cast<char16>(ll16e);
-  (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' to 'char16_e' is not allowed}}
+  (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) is not allowed}}
   (void)static_cast<longlong16>(ll16e);
   (void)static_cast<longlong16_e>(ll16e);
 
@@ -194,11 +194,11 @@
 typedef double dblx2 __attribute__((__vector_size__(16)));
 typedef double dblx4 __attribute__((__vector_size__(32)));
 
-void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' for 1st argument}}
+void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' (vector of 2 'float' values) for 1st argument}}
 void accept_fltx4(fltx4);
 void accept_dblx2(dblx2);
 void accept_dblx4(dblx4);
-void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' to 'bool' for 1st argument}}
+void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' (vector of 2 'float' values) to 'bool' for 1st argument}}
 
 void test(fltx2 fltx2_val, fltx4 fltx4_val, dblx2 dblx2_val, dblx4 dblx4_val) {
   // Exact matches
diff --git a/test/SemaCXX/warn-absolute-value-header.cpp b/test/SemaCXX/warn-absolute-value-header.cpp
index 01aaabc..96e6a31 100644
--- a/test/SemaCXX/warn-absolute-value-header.cpp
+++ b/test/SemaCXX/warn-absolute-value-header.cpp
@@ -1,37 +1,53 @@
 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value
 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only %s -Wabsolute-value -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
 
-extern "C" int abs(int);
+extern "C" {
+  int abs(int);
+  float fabsf(float);
+}
 
-// Wrong signature
-int fabsf(int);
+namespace std {
+  int abs(int);
+  float abs(float);
+}
 
-void test_int(int i, unsigned u, long long ll, float f, double d) {
-  (void)abs(i);
-
-  // Remove abs call
-  (void)abs(u);
-  // expected-warning@-1{{taking the absolute value of unsigned type 'unsigned int' has no effect}}
-  // expected-note@-2{{remove the call to 'abs' since unsigned values cannot be negative}}
-  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
-
-  int llabs;
-  (void)llabs;
-  // Conflict in names, suggest qualified name
-  (void)abs(ll);
-  // expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
-  // expected-note@-2{{use function '::llabs' instead}}
-  // expected-note@-3{{please include the header <stdlib.h> or explicitly provide a declaration for 'llabs'}}
-  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:12}:"::llabs"
-
-  // Conflict in names, no notes
-  (void)abs(f);
-  // expected-warning@-1{{using integer absolute value function 'abs' when argument is of floating point type}}
-
-  // Suggest header.
+void test(long long ll, double d, int i, float f) {
+  // Suggest including cmath
   (void)abs(d);
   // expected-warning@-1{{using integer absolute value function 'abs' when argument is of floating point type}}
-  // expected-note@-2{{use function 'fabs' instead}}
-  // expected-note@-3{{please include the header <math.h> or explicitly provide a declaration for 'fabs'}}
-  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:12}:"fabs"
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // expected-note@-3{{please include the header <cmath> or explicitly provide a declaration for 'std::abs'}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:12}:"std::abs"
+
+  (void)fabsf(d);
+  // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // expected-note@-3{{please include the header <cmath> or explicitly provide a declaration for 'std::abs'}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:14}:"std::abs"
+
+  // Suggest including cstdlib
+  (void)abs(ll);
+  // expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // expected-note@-3{{please include the header <cstdlib> or explicitly provide a declaration for 'std::abs'}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:12}:"std::abs"
+  (void)fabsf(ll);
+  // expected-warning@-1{{using floating point absolute value function 'fabsf' when argument is of integer type}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // expected-note@-3{{please include the header <cstdlib> or explicitly provide a declaration for 'std::abs'}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:9-[[@LINE-4]]:14}:"std::abs"
+
+  // Proper function already called, no warnings.
+  (void)abs(i);
+  (void)fabsf(f);
+
+  // Declarations found, suggest name change.
+  (void)fabsf(i);
+  // expected-warning@-1{{using floating point absolute value function 'fabsf' when argument is of integer type}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)abs(f);
+  // expected-warning@-1{{using integer absolute value function 'abs' when argument is of floating point type}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
 }
diff --git a/test/SemaCXX/warn-absolute-value.cpp b/test/SemaCXX/warn-absolute-value.cpp
new file mode 100644
index 0000000..8a8a6fd
--- /dev/null
+++ b/test/SemaCXX/warn-absolute-value.cpp
@@ -0,0 +1,823 @@
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value -std=c++11
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only %s -Wabsolute-value -fdiagnostics-parseable-fixits -std=c++11 2>&1 | FileCheck %s
+
+extern "C" {
+int abs(int);
+long int labs(long int);
+long long int llabs(long long int);
+
+float fabsf(float);
+double fabs(double);
+long double fabsl(long double);
+
+float cabsf(float _Complex);
+double cabs(double _Complex);
+long double cabsl(long double _Complex);
+}
+
+namespace std {
+
+inline namespace __1 {
+int abs(int);
+long int abs(long int);
+long long int abs(long long int);
+}
+
+float abs(float);
+double abs(double);
+long double abs(long double);
+
+template <typename T>
+double abs(T);
+
+}
+
+void test_int(int x) {
+  (void)std::abs(x);
+
+  (void)abs(x);
+  (void)labs(x);
+  (void)llabs(x);
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)cabs(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)__builtin_abs(x);
+  (void)__builtin_labs(x);
+  (void)__builtin_llabs(x);
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+}
+
+void test_long(long x) {
+  (void)std::abs(x);
+
+  (void)abs(x);  // no warning - int and long are same length for this target
+  (void)labs(x);
+  (void)llabs(x);
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)cabs(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)__builtin_abs(x);  // no warning - int and long are same length for
+                           // this target
+  (void)__builtin_labs(x);
+  (void)__builtin_llabs(x);
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+}
+
+void test_long_long(long long x) {
+  (void)std::abs(x);
+
+  (void)abs(x);
+  // expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
+  (void)labs(x);
+  // expected-warning@-1{{absolute value function 'labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)llabs(x);
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)cabs(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1{{absolute value function '__builtin_abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
+  (void)__builtin_labs(x);
+  // expected-warning@-1{{absolute value function '__builtin_labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_llabs(x);
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+}
+
+void test_float(float x) {
+  (void)std::abs(x);
+
+  (void)abs(x);
+  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
+  (void)labs(x);
+  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)llabs(x);
+  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)fabsf(x);
+  (void)fabs(x);
+  (void)fabsl(x);
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)cabs(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+
+  (void)__builtin_fabsf(x);
+  (void)__builtin_fabs(x);
+  (void)__builtin_fabsl(x);
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+}
+
+void test_double(double x) {
+  (void)std::abs(x);
+
+  (void)abs(x);
+  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
+  (void)labs(x);
+  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)llabs(x);
+  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)fabsf(x);
+  // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)fabs(x);
+  (void)fabsl(x);
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)cabs(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1{{absolute value function '__builtin_fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_fabs(x);
+  (void)__builtin_fabsl(x);
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+}
+
+void test_long_double(long double x) {
+  (void)std::abs(x);
+
+  (void)abs(x);
+  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
+  (void)labs(x);
+  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)llabs(x);
+  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)fabsf(x);
+  // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'long double' but has parameter of type 'float' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)fabs(x);
+  // expected-warning@-1{{absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)fabsl(x);
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+  (void)cabs(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
+  (void)cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1{{absolute value function '__builtin_fabsf' given an argument of type 'long double' but has parameter of type 'float' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1{{absolute value function '__builtin_fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value}}
+  // expected-note@-2{{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_fabsl(x);
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
+  // expected-note@-2 {{use function 'std::abs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
+}
+
+void test_complex_float(_Complex float x) {
+  (void)abs(x);
+  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabsf"
+  (void)labs(x);
+  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsf"
+  (void)llabs(x);
+  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
+  (void)fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsf"
+  (void)fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
+
+  (void)cabsf(x);
+  (void)cabs(x);
+  (void)cabsl(x);
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabsf"
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsf"
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsf"
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsf' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
+
+  (void)__builtin_cabsf(x);
+  (void)__builtin_cabs(x);
+  (void)__builtin_cabsl(x);
+}
+
+void test_complex_double(_Complex double x) {
+  (void)abs(x);
+  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabs"
+  (void)labs(x);
+  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabs"
+  (void)llabs(x);
+  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
+  (void)fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabs"
+  (void)fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex double' but has parameter of type '_Complex float' which may cause truncation of value}}
+  // expected-note@-2 {{use function 'cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
+  (void)cabs(x);
+  (void)cabsl(x);
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabs"
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabs"
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabs"
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex double' but has parameter of type '_Complex float' which may cause truncation of value}}
+  // expected-note@-2 {{use function '__builtin_cabs' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
+  (void)__builtin_cabs(x);
+  (void)__builtin_cabsl(x);
+}
+
+void test_complex_long_double(_Complex long double x) {
+  (void)abs(x);
+  // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabsl"
+  (void)labs(x);
+  // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
+  (void)llabs(x);
+  // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
+  (void)fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
+  (void)fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
+  (void)cabs(x);
+  // expected-warning@-1 {{absolute value function 'cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
+  // expected-note@-2 {{use function 'cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
+  (void)cabsl(x);
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabsl"
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{absolute value function '__builtin_cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
+  // expected-note@-2 {{use function '__builtin_cabsl' instead}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
+  (void)__builtin_cabsl(x);
+}
+
+void test_unsigned_int(unsigned int x) {
+  (void)std::abs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'std::abs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:17}:""
+
+  (void)abs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
+  (void)labs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
+  (void)llabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+  (void)fabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
+  (void)fabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+  (void)cabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
+  (void)cabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+}
+
+void test_unsigned_long(unsigned long x) {
+  (void)std::abs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'std::abs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:17}:""
+
+  (void)abs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
+  (void)labs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
+  (void)llabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+
+  (void)fabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+  (void)fabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
+  (void)fabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+
+  (void)cabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+  (void)cabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
+  (void)cabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
+
+  (void)__builtin_abs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
+  (void)__builtin_labs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
+  (void)__builtin_llabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+
+  (void)__builtin_fabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+  (void)__builtin_fabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
+  (void)__builtin_fabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+
+  (void)__builtin_cabsf(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+  (void)__builtin_cabs(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
+  (void)__builtin_cabsl(x);
+  // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
+  // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
+}
+
diff --git a/test/SemaCXX/warn-absolute-value2.cpp b/test/SemaCXX/warn-absolute-value2.cpp
deleted file mode 100644
index 5f7e891..0000000
--- a/test/SemaCXX/warn-absolute-value2.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value
-
-extern "C" {
-int abs(int);
-double fabs(double);
-}
-
-using ::fabs;
-
-double test(double x) {
-  return ::abs(x);
-  // expected-warning@-1{{using integer absolute value function 'abs' when argument is of floating point type}}
-}
diff --git a/test/SemaCXX/warn-consumed-analysis.cpp b/test/SemaCXX/warn-consumed-analysis.cpp
index bd091c6..977b862 100644
--- a/test/SemaCXX/warn-consumed-analysis.cpp
+++ b/test/SemaCXX/warn-consumed-analysis.cpp
@@ -704,6 +704,8 @@
   void clear() CALLABLE_WHEN("unknown", "consumed") SET_TYPESTATE(consumed);
 
   ~Status() CALLABLE_WHEN("unknown", "consumed");
+
+  operator bool() const; // Will not consume the object.
 };
 
 
@@ -735,6 +737,10 @@
   Status s = doSomething();
 }  // expected-warning {{invalid invocation of method '~Status' on object 's' while it is in the 'unconsumed' state}}
 
+void testTemporariesWithControlFlow(bool a) {
+  bool b = false || doSomething(); // expected-warning {{invalid invocation of method '~Status' on a temporary object while it is in the 'unconsumed' state}}
+}
+
 Status testSimpleTemporariesReturn0() {
   return doSomething();
 }
diff --git a/test/SemaCXX/warn-float-conversion.cpp b/test/SemaCXX/warn-float-conversion.cpp
new file mode 100644
index 0000000..22c3304
--- /dev/null
+++ b/test/SemaCXX/warn-float-conversion.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s -Wfloat-conversion
+
+bool ReturnBool(float f) {
+  return f;  //expected-warning{{conversion}}
+}
+
+char ReturnChar(float f) {
+  return f;  //expected-warning{{conversion}}
+}
+
+int ReturnInt(float f) {
+  return f;  //expected-warning{{conversion}}
+}
+
+long ReturnLong(float f) {
+  return f;  //expected-warning{{conversion}}
+}
+
+void Convert(float f, double d, long double ld) {
+  bool b;
+  char c;
+  int i;
+  long l;
+
+  b = f;  //expected-warning{{conversion}}
+  b = d;  //expected-warning{{conversion}}
+  b = ld;  //expected-warning{{conversion}}
+  c = f;  //expected-warning{{conversion}}
+  c = d;  //expected-warning{{conversion}}
+  c = ld;  //expected-warning{{conversion}}
+  i = f;  //expected-warning{{conversion}}
+  i = d;  //expected-warning{{conversion}}
+  i = ld;  //expected-warning{{conversion}}
+  l = f;  //expected-warning{{conversion}}
+  l = d;  //expected-warning{{conversion}}
+  l = ld;  //expected-warning{{conversion}}
+}
+
diff --git a/test/SemaCXX/warn-thread-safety-parsing.cpp b/test/SemaCXX/warn-thread-safety-parsing.cpp
index 6d4ad39..6f9e7de 100644
--- a/test/SemaCXX/warn-thread-safety-parsing.cpp
+++ b/test/SemaCXX/warn-thread-safety-parsing.cpp
@@ -109,26 +109,26 @@
 
 int noanal_testfn(int y) {
   int x NO_THREAD_SAFETY_ANALYSIS = y; // \
-    // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}}
+    // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
   return x;
 };
 
 int noanal_test_var NO_THREAD_SAFETY_ANALYSIS; // \
-  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}}
+  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
 
 class NoanalFoo {
  private:
   int test_field NO_THREAD_SAFETY_ANALYSIS; // \
-    // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}}
+    // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
   void test_method() NO_THREAD_SAFETY_ANALYSIS;
 };
 
 class NO_THREAD_SAFETY_ANALYSIS NoanalTestClass { // \
-  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}}
+  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
 };
 
 void noanal_fun_params(int lvar NO_THREAD_SAFETY_ANALYSIS); // \
-  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}}
+  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
 
 
 //-----------------------------------------//
@@ -577,26 +577,26 @@
 
 int elf_testfn(int y) {
   int x EXCLUSIVE_LOCK_FUNCTION() = y; // \
-    // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
   return x;
 };
 
 int elf_test_var EXCLUSIVE_LOCK_FUNCTION(); // \
-  // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
 
 class ElfFoo {
  private:
   int test_field EXCLUSIVE_LOCK_FUNCTION(); // \
-    // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
   void test_method() EXCLUSIVE_LOCK_FUNCTION();
 };
 
 class EXCLUSIVE_LOCK_FUNCTION() ElfTestClass { // \
-  // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
 };
 
 void elf_fun_params(int lvar EXCLUSIVE_LOCK_FUNCTION()); // \
-  // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
 
 // Check argument parsing.
 
@@ -649,25 +649,25 @@
 
 int slf_testfn(int y) {
   int x SHARED_LOCK_FUNCTION() = y; // \
-    // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_lock_function' attribute only applies to functions}}
   return x;
 };
 
 int slf_test_var SHARED_LOCK_FUNCTION(); // \
-  // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_lock_function' attribute only applies to functions}}
 
 void slf_fun_params(int lvar SHARED_LOCK_FUNCTION()); // \
-  // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_lock_function' attribute only applies to functions}}
 
 class SlfFoo {
  private:
   int test_field SHARED_LOCK_FUNCTION(); // \
-    // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_lock_function' attribute only applies to functions}}
   void test_method() SHARED_LOCK_FUNCTION();
 };
 
 class SHARED_LOCK_FUNCTION() SlfTestClass { // \
-  // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_lock_function' attribute only applies to functions}}
 };
 
 // Check argument parsing.
@@ -725,26 +725,26 @@
 
 int etf_testfn(int y) {
   int x EXCLUSIVE_TRYLOCK_FUNCTION(1) = y; // \
-    // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
   return x;
 };
 
 int etf_test_var EXCLUSIVE_TRYLOCK_FUNCTION(1); // \
-  // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
 
 class EtfFoo {
  private:
   int test_field EXCLUSIVE_TRYLOCK_FUNCTION(1); // \
-    // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
   void test_method() EXCLUSIVE_TRYLOCK_FUNCTION(1);
 };
 
 class EXCLUSIVE_TRYLOCK_FUNCTION(1) EtfTestClass { // \
-  // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
 };
 
 void etf_fun_params(int lvar EXCLUSIVE_TRYLOCK_FUNCTION(1)); // \
-  // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
 
 // Check argument parsing.
 
@@ -798,26 +798,26 @@
 
 int stf_testfn(int y) {
   int x SHARED_TRYLOCK_FUNCTION(1) = y; // \
-    // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
   return x;
 };
 
 int stf_test_var SHARED_TRYLOCK_FUNCTION(1); // \
-  // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
 
 void stf_fun_params(int lvar SHARED_TRYLOCK_FUNCTION(1)); // \
-  // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
 
 
 class StfFoo {
  private:
   int test_field SHARED_TRYLOCK_FUNCTION(1); // \
-    // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
   void test_method() SHARED_TRYLOCK_FUNCTION(1);
 };
 
 class SHARED_TRYLOCK_FUNCTION(1) StfTestClass { // \
-    // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
 };
 
 // Check argument parsing.
@@ -868,26 +868,26 @@
 
 int uf_testfn(int y) {
   int x UNLOCK_FUNCTION() = y; // \
-    // expected-warning {{'unlock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'unlock_function' attribute only applies to functions}}
   return x;
 };
 
 int uf_test_var UNLOCK_FUNCTION(); // \
-  // expected-warning {{'unlock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'unlock_function' attribute only applies to functions}}
 
 class UfFoo {
  private:
   int test_field UNLOCK_FUNCTION(); // \
-    // expected-warning {{'unlock_function' attribute only applies to functions and methods}}
+    // expected-warning {{'unlock_function' attribute only applies to functions}}
   void test_method() UNLOCK_FUNCTION();
 };
 
 class NO_THREAD_SAFETY_ANALYSIS UfTestClass { // \
-  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}}
+  // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
 };
 
 void uf_fun_params(int lvar UNLOCK_FUNCTION()); // \
-  // expected-warning {{'unlock_function' attribute only applies to functions and methods}}
+  // expected-warning {{'unlock_function' attribute only applies to functions}}
 
 // Check argument parsing.
 
@@ -944,25 +944,25 @@
 
 int lr_testfn(int y) {
   int x LOCK_RETURNED(mu1) = y; // \
-    // expected-warning {{'lock_returned' attribute only applies to functions and methods}}
+    // expected-warning {{'lock_returned' attribute only applies to functions}}
   return x;
 };
 
 int lr_test_var LOCK_RETURNED(mu1); // \
-  // expected-warning {{'lock_returned' attribute only applies to functions and methods}}
+  // expected-warning {{'lock_returned' attribute only applies to functions}}
 
 void lr_fun_params(int lvar LOCK_RETURNED(mu1)); // \
-  // expected-warning {{'lock_returned' attribute only applies to functions and methods}}
+  // expected-warning {{'lock_returned' attribute only applies to functions}}
 
 class LrFoo {
  private:
   int test_field LOCK_RETURNED(mu1); // \
-    // expected-warning {{'lock_returned' attribute only applies to functions and methods}}
+    // expected-warning {{'lock_returned' attribute only applies to functions}}
   void test_method() LOCK_RETURNED(mu1);
 };
 
 class LOCK_RETURNED(mu1) LrTestClass { // \
-    // expected-warning {{'lock_returned' attribute only applies to functions and methods}}
+    // expected-warning {{'lock_returned' attribute only applies to functions}}
 };
 
 // Check argument parsing.
@@ -1011,25 +1011,25 @@
 
 int le_testfn(int y) {
   int x LOCKS_EXCLUDED(mu1) = y; // \
-    // expected-warning {{'locks_excluded' attribute only applies to functions and methods}}
+    // expected-warning {{'locks_excluded' attribute only applies to functions}}
   return x;
 };
 
 int le_test_var LOCKS_EXCLUDED(mu1); // \
-  // expected-warning {{'locks_excluded' attribute only applies to functions and methods}}
+  // expected-warning {{'locks_excluded' attribute only applies to functions}}
 
 void le_fun_params(int lvar LOCKS_EXCLUDED(mu1)); // \
-  // expected-warning {{'locks_excluded' attribute only applies to functions and methods}}
+  // expected-warning {{'locks_excluded' attribute only applies to functions}}
 
 class LeFoo {
  private:
   int test_field LOCKS_EXCLUDED(mu1); // \
-    // expected-warning {{'locks_excluded' attribute only applies to functions and methods}}
+    // expected-warning {{'locks_excluded' attribute only applies to functions}}
   void test_method() LOCKS_EXCLUDED(mu1);
 };
 
 class LOCKS_EXCLUDED(mu1) LeTestClass { // \
-  // expected-warning {{'locks_excluded' attribute only applies to functions and methods}}
+  // expected-warning {{'locks_excluded' attribute only applies to functions}}
 };
 
 // Check argument parsing.
@@ -1078,25 +1078,25 @@
 
 int elr_testfn(int y) {
   int x EXCLUSIVE_LOCKS_REQUIRED(mu1) = y; // \
-    // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}}
+    // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
   return x;
 };
 
 int elr_test_var EXCLUSIVE_LOCKS_REQUIRED(mu1); // \
-  // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
 
 void elr_fun_params(int lvar EXCLUSIVE_LOCKS_REQUIRED(mu1)); // \
-  // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
 
 class ElrFoo {
  private:
   int test_field EXCLUSIVE_LOCKS_REQUIRED(mu1); // \
-    // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}}
+    // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
   void test_method() EXCLUSIVE_LOCKS_REQUIRED(mu1);
 };
 
 class EXCLUSIVE_LOCKS_REQUIRED(mu1) ElrTestClass { // \
-  // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}}
+  // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
 };
 
 // Check argument parsing.
@@ -1146,25 +1146,25 @@
 
 int slr_testfn(int y) {
   int x SHARED_LOCKS_REQUIRED(mu1) = y; // \
-    // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_locks_required' attribute only applies to functions}}
   return x;
 };
 
 int slr_test_var SHARED_LOCKS_REQUIRED(mu1); // \
-  // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_locks_required' attribute only applies to functions}}
 
 void slr_fun_params(int lvar SHARED_LOCKS_REQUIRED(mu1)); // \
-  // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_locks_required' attribute only applies to functions}}
 
 class SlrFoo {
  private:
   int test_field SHARED_LOCKS_REQUIRED(mu1); // \
-    // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}}
+    // expected-warning {{'shared_locks_required' attribute only applies to functions}}
   void test_method() SHARED_LOCKS_REQUIRED(mu1);
 };
 
 class SHARED_LOCKS_REQUIRED(mu1) SlrTestClass { // \
-  // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}}
+  // expected-warning {{'shared_locks_required' attribute only applies to functions}}
 };
 
 // Check argument parsing.
diff --git a/test/SemaCXX/warn-unreachable.cpp b/test/SemaCXX/warn-unreachable.cpp
index 04bd743..b08467a 100644
--- a/test/SemaCXX/warn-unreachable.cpp
+++ b/test/SemaCXX/warn-unreachable.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fcxx-exceptions -fexceptions -fsyntax-only -verify -fblocks -std=c++11 -Wunreachable-code-aggressive -Wno-unused-value
+// RUN: %clang_cc1 %s -fcxx-exceptions -fexceptions -fsyntax-only -verify -fblocks -std=c++11 -Wunreachable-code-aggressive -Wno-unused-value -Wno-tautological-compare
 
 int &halt() __attribute__((noreturn));
 int &live();
@@ -327,3 +327,83 @@
     calledFun();
 }
 
+void test_with_paren_silencing_impcast(int x) {
+  if (0) calledFun(); // expected-warning {{will never be executed}} expected-note {{silence by adding parentheses to mark code as explicitly dead}}
+  if ((0)) calledFun(); // no-warning
+
+  if (1) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
+    calledFun();
+  else
+    calledFun(); // expected-warning {{will never be executed}}
+
+  if ((1))
+    calledFun();
+  else
+    calledFun(); // no-warning
+  
+  if (!1) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
+    calledFun(); // expected-warning {{code will never be executed}}
+  else
+    calledFun();
+  
+  if ((!1))
+    calledFun(); // no-warning
+  else
+    calledFun();
+  
+  if (!(1))
+    calledFun(); // no-warning
+  else
+    calledFun();
+}
+
+void tautological_compare(bool x, int y) {
+  if (x > 10)           // expected-note {{silence}}
+    calledFun();        // expected-warning {{will never be executed}}
+  if (10 < x)           // expected-note {{silence}}
+    calledFun();        // expected-warning {{will never be executed}}
+  if (x == 10)          // expected-note {{silence}}
+    calledFun();        // expected-warning {{will never be executed}}
+
+  if (x < 10)           // expected-note {{silence}}
+    calledFun();
+  else
+    calledFun();        // expected-warning {{will never be executed}}
+  if (10 > x)           // expected-note {{silence}}
+    calledFun();
+  else
+    calledFun();        // expected-warning {{will never be executed}}
+  if (x != 10)          // expected-note {{silence}}
+    calledFun();
+  else
+    calledFun();        // expected-warning {{will never be executed}}
+
+  if (y != 5 && y == 5) // expected-note {{silence}}
+    calledFun();        // expected-warning {{will never be executed}}
+
+  if (y > 5 && y < 4)   // expected-note {{silence}}
+    calledFun();        // expected-warning {{will never be executed}}
+
+  if (y < 10 || y > 5)  // expected-note {{silence}}
+    calledFun();
+  else
+    calledFun();        // expected-warning {{will never be executed}}
+
+  // TODO: Extend warning to the following code:
+  if (x < -1)
+    calledFun();
+  if (x == -1)
+    calledFun();
+
+  if (x != -1)
+    calledFun();
+  else
+    calledFun();
+  if (-1 > x)
+    calledFun();
+  else
+    calledFun();
+
+  if (y == -1 && y != -1)
+    calledFun();
+}
diff --git a/test/SemaCXX/warn-unused-comparison.cpp b/test/SemaCXX/warn-unused-comparison.cpp
index 8e6f0f4..3afad58 100644
--- a/test/SemaCXX/warn-unused-comparison.cpp
+++ b/test/SemaCXX/warn-unused-comparison.cpp
@@ -106,3 +106,30 @@
 
   X<int> x;
 }
+
+namespace PR19724 {
+class stream {
+} cout, cin;
+
+stream &operator<(stream &s, int);
+bool operator<(stream &s, stream &s2);
+
+void test() {
+  cout < 5;    // no warning, operator returns a reference
+  cout < cin;  // expected-warning {{relational comparison result unused}}
+}
+}
+
+namespace PR19791 {
+struct S {
+  void operator!=(int);
+  int operator==(int);
+};
+
+void test() {
+  S s;
+  s != 1;
+  s == 1;  // expected-warning{{equality comparison result unused}}
+           // expected-note@-1{{use '=' to turn this equality comparison into an assignment}}
+}
+}
diff --git a/test/SemaCXX/warn-unused-filescoped.cpp b/test/SemaCXX/warn-unused-filescoped.cpp
index b0af5b3..df4c47e 100644
--- a/test/SemaCXX/warn-unused-filescoped.cpp
+++ b/test/SemaCXX/warn-unused-filescoped.cpp
@@ -32,6 +32,13 @@
   inline void bar(int, int) { }
 };
 
+namespace pr19713 {
+#if __cplusplus >= 201103L
+  static constexpr int constexpr1() { return 1; }
+  constexpr int constexpr2() { return 2; }
+#endif
+}
+
 #else
 #define HEADER
 #include "warn-unused-filescoped.cpp"
@@ -193,4 +200,12 @@
 static void func() {}
 }
 
+namespace pr19713 {
+#if __cplusplus >= 201103L
+  // FIXME: We should warn on both of these.
+  static constexpr int constexpr3() { return 1; } // expected-warning {{unused}}
+  constexpr int constexpr4() { return 2; }
+#endif
+}
+
 #endif
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp
index ecb36ec..8dcbe72 100644
--- a/test/SemaCXX/warn-unused-variables.cpp
+++ b/test/SemaCXX/warn-unused-variables.cpp
@@ -122,8 +122,19 @@
   template<typename T> const int l = 0; // no warning
   int b = l<int>;
 
+  // PR19558
+  template<typename T> const int o = 0; // no warning
+  template<typename T> const int o<T*> = 0; // no warning
+  int c = o<int*>;
+
+  template<> int o<void> = 0; // no warning
+  int d = o<void>;
+
   // FIXME: It'd be nice to warn here.
   template<typename T> int m = 0;
+  template<typename T> int m<T*> = 0;
+
+  template<> const int m<void> = 0; // expected-warning {{unused variable}}
 }
 
 namespace ctor_with_cleanups {
diff --git a/test/SemaCXX/writable-strings-deprecated.cpp b/test/SemaCXX/writable-strings-deprecated.cpp
index b8f605b..f925833 100644
--- a/test/SemaCXX/writable-strings-deprecated.cpp
+++ b/test/SemaCXX/writable-strings-deprecated.cpp
@@ -1,14 +1,25 @@
 // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated -Wdeprecated-increment-bool -verify %s
 // RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Wno-write-strings -verify %s
 // RUN: %clang_cc1 -fsyntax-only -Werror=c++11-compat -verify %s -DERROR
+// RUN: %clang_cc1 -fsyntax-only -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -pedantic-errors -DERROR
 // rdar://8827606
 
 char *fun(void)
 {
    return "foo";
+#if __cplusplus >= 201103L
 #ifdef ERROR
-   // expected-error@-2 {{deprecated}}
+   // expected-error@-3 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#else
+   // expected-warning@-5 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
+#endif
+#elif defined(ERROR)
+   // expected-error@-8 {{deprecated}}
 #endif
 }