From a547eb27fa5ed28b631f5a72f369e68e9c3cca1f Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 14 Jul 2016 00:11:03 +0000 Subject: P0305R0: Semantic analysis and code generation for C++17 init-statement for 'if' and 'switch': if (stmt; condition) { ... } Patch by Anton Bikineev! Some minor formatting and comment tweets by me. llvm-svn: 275350 --- clang/test/PCH/cxx1z-init-statement.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 clang/test/PCH/cxx1z-init-statement.cpp (limited to 'clang/test/PCH/cxx1z-init-statement.cpp') diff --git a/clang/test/PCH/cxx1z-init-statement.cpp b/clang/test/PCH/cxx1z-init-statement.cpp new file mode 100644 index 00000000000..d08fb7c56b7 --- /dev/null +++ b/clang/test/PCH/cxx1z-init-statement.cpp @@ -0,0 +1,17 @@ +// Test this without pch. +// RUN: %clang_cc1 -std=c++1z -include %S/cxx1z-init-statement.h -fsyntax-only -emit-llvm -o - %s + +// Test with pch. +// RUN: %clang_cc1 -x c++ -std=c++1z -emit-pch -o %t %S/cxx1z-init-statement.h +// RUN: %clang_cc1 -std=c++1z -include-pch %t -fsyntax-only -emit-llvm -o - %s + +void g0(void) { + static_assert(test_if(-1) == -1, ""); + static_assert(test_if(0) == 0, ""); +} + +void g1(void) { + static_assert(test_switch(-1) == -1, ""); + static_assert(test_switch(0) == 0, ""); + static_assert(test_switch(1) == 1, ""); +} -- cgit v1.2.3