summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-16 17:02:56 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-16 17:02:56 +0000
commitc8aed844acdc89884d630c7e3266ecd8d4101847 (patch)
tree0d046a9255339220c1bbd6ba14e84e5304acbe10 /gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c
parent74f8420a5b204c5e021ce05b3d0d79ba9718360a (diff)
downloadgcc-c8aed844acdc89884d630c7e3266ecd8d4101847.tar.gz
2016-04-16 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9 svn merge -r231651:232605 ^/trunk }} [gcc/] 2016-04-16 Basile Starynkevitch <basile@starynkevitch.net> * melt/libmelt-ana-gimple.melt: (melt_build_transaction_with_label_norm): New inlined function, for gimple_transaction operator implementation... git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@235064 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c')
-rw-r--r--gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c b/gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c
new file mode 100644
index 00000000000..6f75476deb3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/diagnostic-range-static-assert.c
@@ -0,0 +1,24 @@
+/* { dg-options "-fdiagnostics-show-caret" } */
+
+void test_nonconst_static_assert (int param)
+{
+ int local = 0;
+
+ _Static_assert (param > 0, "message"); /* { dg-error "expression in static assertion is not constant" } */
+/* { dg-begin-multiline-output "" }
+ _Static_assert (param > 0, "message");
+ ~~~~~~^~~
+{ dg-end-multiline-output "" } */
+
+ _Static_assert (param, "message"); /* { dg-error "expression in static assertion is not constant" } */
+/* { dg-begin-multiline-output "" }
+ _Static_assert (param, "message");
+ ^~~~~
+{ dg-end-multiline-output "" } */
+
+ _Static_assert (local, "message"); /* { dg-error "expression in static assertion is not constant" } */
+/* { dg-begin-multiline-output "" }
+ _Static_assert (local, "message");
+ ^~~~~
+{ dg-end-multiline-output "" } */
+}