re PR c++/53464 (Invalid default value for non-type template parameter is accepted)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 24 May 2012 15:12:37 +0000 (15:12 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 24 May 2012 15:12:37 +0000 (15:12 +0000)
2012-05-24  Paolo Carlini  <paolo.carlini@oracle.com>

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

From-SVN: r187842

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

index c00557ece63690cd162a23c53d96a97a1dda8353..065b5a33213681823dde4dd5a8eea5c7bb42bcd8 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53464
+       * g++.dg/cpp0x/constexpr-default1.C: New.
+
 2012-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/32080
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-default1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-default1.C
new file mode 100644 (file)
index 0000000..68d50b6
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/53464
+// { dg-do compile { target c++11 } }
+
+template <int value>
+struct bar
+{
+  static constexpr int get()
+  {
+    return value;
+  }
+};
+
+template <typename A, int value = A::get()>
+struct foo
+{
+};
+
+int main()
+{
+  typedef foo<bar<0>> type;
+  return 0;
+}