+2020-07-20 Gary Benson <gbenson@redhat.com>
+
+ * gdb.cp/align.exp: Fix "alignof (void)" tests when compiling
+ with clang.
+
2020-07-20 Tom de Vries <tdevries@suse.de>
* gdb.threads/omp-par-scope.c (lock, lock2): New variable.
unsigned a_int3 = alignof (int[3]);
+#if !defined (__clang__)
unsigned a_void = alignof (void);
+#endif
struct base { char c; };
struct derived : public virtual base { int i; };
set expected [get_integer_valueof a_int3 0]
gdb_test "print alignof(int\[3\])" " = $expected"
-set expected [get_integer_valueof a_void 0]
+
+# As an extension, GCC allows void pointer arithmetic, with
+# sizeof(void) and alignof(void) both 1. This test checks
+# GDB's support of GCC's extension.
+if [test_compiler_info clang*] {
+ # Clang doesn't support GCC's extension.
+ set expected 1
+} else {
+ set expected [get_integer_valueof a_void 0]
+}
gdb_test "print alignof(void)" " = $expected"