Produce a diagnostic if alignas is applied to an expression. Neither C11 nor
C++11 allows that.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173789 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp
index ccdf45e..d76fcf5 100644
--- a/test/SemaCXX/alignof-sizeof-reference.cpp
+++ b/test/SemaCXX/alignof-sizeof-reference.cpp
@@ -4,8 +4,10 @@
 char ar[sizeof(s0&)]; // expected-error {{invalid application of 'sizeof' to an incomplete type}}
 void test() {
   char &r = ar[0];
-  static_assert(alignof(r) == 1, "bad alignment");
+  static_assert(alignof(r) == 1, "bad alignment"); // expected-warning {{GNU extension}}
+  static_assert(alignof(char&) == 1, "bad alignment");
   static_assert(sizeof(r) == 1, "bad size");
+  static_assert(sizeof(char&) == 1, "bad size");
 }
 
 void f();  // expected-note{{possible target for call}}
@@ -18,5 +20,5 @@
 template<typename T> void f_template(); // expected-note{{possible target for call}}
 template<typename T> void f_template(T*); // expected-note{{possible target for call}}
 void rdar9659191() {
-  (void)alignof(f_template<int>); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}
+  (void)alignof(f_template<int>); // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}} expected-warning {{GNU extension}}
 }
diff --git a/test/SemaCXX/attr-cxx0x.cpp b/test/SemaCXX/attr-cxx0x.cpp
index c2576e9..d038e63 100644
--- a/test/SemaCXX/attr-cxx0x.cpp
+++ b/test/SemaCXX/attr-cxx0x.cpp
@@ -28,9 +28,9 @@
 typedef char align_typedef alignas(8); // expected-error {{'alignas' attribute only applies to variables, functions and tag types}}
 template<typename T> using align_alias_template = align_typedef alignas(8); // expected-error {{'alignas' attribute cannot be applied to types}}
 
-static_assert(alignof(align_big) == alignof(int), "k's alignment is wrong");
-static_assert(alignof(align_small) == 1, "j's alignment is wrong");
-static_assert(alignof(align_multiple) == 8, "l's alignment is wrong");
+static_assert(alignof(align_big) == alignof(int), "k's alignment is wrong"); // expected-warning{{'alignof' applied to an expression is a GNU extension}}
+static_assert(alignof(align_small) == 1, "j's alignment is wrong"); // expected-warning{{'alignof' applied to an expression is a GNU extension}}
+static_assert(alignof(align_multiple) == 8, "l's alignment is wrong"); // expected-warning{{'alignof' applied to an expression is a GNU extension}}
 static_assert(alignof(align_member) == 8, "quuux's alignment is wrong");
 static_assert(sizeof(align_member) == 8, "quuux's size is wrong");
 static_assert(alignof(align_class_template<8>) == 8, "template's alignment is wrong");