re PR c++/49604 (forward-declared enum's elements in class scope gets default access...
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 12 May 2017 13:20:21 +0000 (13:20 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 12 May 2017 13:20:21 +0000 (13:20 +0000)
2017-05-12  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/49604
* g++.dg/cpp0x/forw_enum14.C: New.
* g++.dg/cpp0x/forw_enum15.C: Likewise.

From-SVN: r247969

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/forw_enum14.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/forw_enum15.C [new file with mode: 0644]

index ff4327a37346b34dab7f03d370bf999fcac27f85..4b9297b6c650a364953a563cb6ba1868502009d7 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-12  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/49604
+       * g++.dg/cpp0x/forw_enum14.C: New.
+       * g++.dg/cpp0x/forw_enum15.C: Likewise.
+
 2017-05-12  Richard Biener  <rguenther@suse.de>
 
        * g++.dg/tree-ssa/ssa-dse-2.C: Adjust.
diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum14.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum14.C
new file mode 100644 (file)
index 0000000..ac38c18
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/49604
+// { dg-do compile { target c++11 } }
+
+class MyTable {
+public:
+    enum Constants : unsigned;
+};
+
+enum MyTable::Constants : unsigned {
+    LENGTH = 12,
+};
+
+int main()
+{
+    return MyTable::LENGTH;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum15.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum15.C
new file mode 100644 (file)
index 0000000..6581604
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/49604
+// { dg-do compile { target c++11 } }
+
+struct Foo
+{
+private:
+    int val;
+    enum impl_t : int;
+public:
+    Foo(impl_t v) : val(v) {}
+};
+enum Foo::impl_t : int { X };
+
+Foo test = Foo::X;  // { dg-error "private" }