From d3f3e16293e59b54c835e20e32050b805b9ade65 Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Fri, 18 Jan 2019 21:04:25 +0000 Subject: [Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation This patch includes logic for constant expression evaluation of fixed point additions. Differential Revision: https://reviews.llvm.org/D55868 llvm-svn: 351593 --- clang/test/Frontend/fixed_point_errors.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/test/Frontend/fixed_point_errors.c') diff --git a/clang/test/Frontend/fixed_point_errors.c b/clang/test/Frontend/fixed_point_errors.c index 41427e34315..43c50572573 100644 --- a/clang/test/Frontend/fixed_point_errors.c +++ b/clang/test/Frontend/fixed_point_errors.c @@ -232,3 +232,9 @@ void CheckSuffixOnIntegerLiterals() { auto auto_accum = 0k; // expected-error{{invalid suffix 'k' on integer constant}} // expected-warning@-1{{type specifier missing, defaults to 'int'}} } + +// Overflow +short _Accum sa_const = 256.0k; // expected-warning{{implicit conversion from 256.0 cannot fit within the range of values for 'short _Accum'}} +short _Fract sf_const = 1.0hk; // expected-warning{{implicit conversion from 1.0 cannot fit within the range of values for 'short _Fract'}} +unsigned _Accum ua_const = -1.0k; // expected-warning{{implicit conversion from -1.0 cannot fit within the range of values for 'unsigned _Accum'}} +short _Accum sa_const2 = 128.0k + 128.0k; // expected-warning{{implicit conversion from 256.0 cannot fit within the range of values for 'short _Accum'}} -- cgit v1.2.3