re PR c++/65080 (constexpr-ness lost by using alias in definition)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 16 Feb 2015 17:48:08 +0000 (17:48 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 16 Feb 2015 17:48:08 +0000 (17:48 +0000)
2015-02-16  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/65080
* g++.dg/cpp0x/constexpr-65080.C: New.

From-SVN: r220739

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-65080.C [new file with mode: 0644]

index c02263ea5cceeea02c3eb3fad349ca08bea25ed9..252865c20e5cb9aa5c90f50c83a562414d6496e6 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-16  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/65080
+       * g++.dg/cpp0x/constexpr-65080.C: New.
+
 2015-02-16  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/63593
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-65080.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-65080.C
new file mode 100644 (file)
index 0000000..d4b4948
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/65080
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+static constexpr T xxx(){ return T(); }
+
+template <typename T>
+struct foo {
+  using type = T(*)();
+  static constexpr type value[1] = {&xxx<T>};
+};
+
+template <typename T>
+constexpr typename foo<T>::type foo<T>::value[1];
+
+int main() {
+  constexpr int x = foo<int>::value[0]();
+}