From 9cf21ae068bd89f3473b811e4e5567aea6e26185 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 18 Mar 2013 23:37:25 +0000 Subject: Diagnose uses of 'alignof' on functions in -pedantic mode. llvm-svn: 177354 --- clang/test/SemaCXX/attr-cxx0x.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/test/SemaCXX/attr-cxx0x.cpp') diff --git a/clang/test/SemaCXX/attr-cxx0x.cpp b/clang/test/SemaCXX/attr-cxx0x.cpp index 002800e749e..e9276cd2d9e 100644 --- a/clang/test/SemaCXX/attr-cxx0x.cpp +++ b/clang/test/SemaCXX/attr-cxx0x.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -pedantic -std=c++11 %s int align_illegal alignas(3); //expected-error {{requested alignment is not a power of 2}} char align_big alignas(int); @@ -43,3 +43,5 @@ static_assert(alignof(align_class_template<16>) == 16, "template's alignment is static_assert(alignof(align_class_temp_pack_type) == alignof(long), "template's alignment is wrong"); static_assert(alignof(align_class_temp_pack_expr<8, 16, 32>) == 32, "template's alignment is wrong"); static_assert(alignof(outer::inner) == alignof(int) * alignof(double), "template's alignment is wrong"); + +static_assert(alignof(int(int)) >= 1, "alignof(function) not positive"); // expected-warning{{invalid application of 'alignof' to a function type}} -- cgit v1.2.3