summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/utf-cvt.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/ext/utf-cvt.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/ext/utf-cvt.C')
-rw-r--r--gcc/testsuite/g++.dg/ext/utf-cvt.C55
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/utf-cvt.C b/gcc/testsuite/g++.dg/ext/utf-cvt.C
new file mode 100644
index 000000000..286a0d007
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/utf-cvt.C
@@ -0,0 +1,55 @@
+/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
+/* Test the char16_t and char32_t promotion rules. */
+/* { dg-do compile } */
+/* { dg-options "-std=c++0x -Wall -Wconversion -Wsign-conversion -Wsign-promo" } */
+
+extern void f_c (char);
+extern void fsc (signed char);
+extern void fuc (unsigned char);
+extern void f_s (short);
+extern void fss (signed short);
+extern void fus (unsigned short);
+extern void f_i (int);
+extern void fsi (signed int);
+extern void fui (unsigned int);
+extern void f_l (long);
+extern void fsl (signed long);
+extern void ful (unsigned long);
+extern void f_ll (long long);
+extern void fsll (signed long long);
+extern void full (unsigned long long);
+
+void m(char16_t c0, char32_t c1)
+{
+ f_c (c0); /* { dg-warning "alter its value" } */
+ fsc (c0); /* { dg-warning "alter its value" } */
+ fuc (c0); /* { dg-warning "alter its value" } */
+ f_s (c0); /* { dg-warning "change the sign" } */
+ fss (c0); /* { dg-warning "change the sign" } */
+ fus (c0);
+ f_i (c0);
+ fsi (c0);
+ fui (c0);
+ f_l (c0);
+ fsl (c0);
+ ful (c0);
+ f_ll (c0);
+ fsll (c0);
+ full (c0);
+
+ f_c (c1); /* { dg-warning "alter its value" } */
+ fsc (c1); /* { dg-warning "alter its value" } */
+ fuc (c1); /* { dg-warning "alter its value" } */
+ f_s (c1); /* { dg-warning "alter its value" } */
+ fss (c1); /* { dg-warning "alter its value" } */
+ fus (c1); /* { dg-warning "alter its value" } */
+ f_i (c1); /* { dg-warning "change the sign" } */
+ fsi (c1); /* { dg-warning "change the sign" } */
+ fui (c1);
+ f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
+ fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
+ ful (c1);
+ f_ll (c1);
+ fsll (c1);
+ full (c1);
+}