summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Khalikov <d.khalikov@partner.samsung.com>2017-10-31 19:15:13 +0300
committerDenis Khalikov <d.khalikov@partner.samsung.com>2017-10-31 19:15:13 +0300
commit68e476387b351df870e9e0d50f724443fc94d71b (patch)
tree845fe1800bc6d9d2d3870d3956a7297154c18285
parent5fc8a1dbcd8e6898ae0ae3f0636d75a7e6df4cda (diff)
downloadlinaro-gcc-sandbox/denis13/isan.tar.gz
linaro-gcc-sandbox/denis13/isan.tar.bz2
linaro-gcc-sandbox/denis13/isan.zip
Change-Id: Ied1de5e876e6efa168873acc58d9ee500d266321
-rw-r--r--gcc/testsuite/g++.dg/isan/constexpr.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/isan/constexpr.C b/gcc/testsuite/g++.dg/isan/constexpr.C
index 4896396397b..b47511e3621 100644
--- a/gcc/testsuite/g++.dg/isan/constexpr.C
+++ b/gcc/testsuite/g++.dg/isan/constexpr.C
@@ -6,3 +6,25 @@
constexpr int foo (int i) {
return std::__lg (i);
}
+
+constexpr const char *string = "hello";
+
+constexpr unsigned int str2int(const char *str, int h = 0) {
+ return !str[h] ? 5381 : (str2int(str, h + 1) * 33) ^ str[h];
+}
+
+
+constexpr unsigned int arr[] = {1, 2, 3, 4, 5};
+
+constexpr unsigned int index = 1;
+
+class A
+{
+ static constexpr const unsigned int *ptr = arr + index;
+};
+
+int main ()
+{
+ constexpr unsigned int result_value = str2int (string);
+ A a;
+}