From 9206028e8c65941431301ad405d2c87cd3eb2f7f Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 12 May 2017 13:20:21 +0000 Subject: [PATCH] re PR c++/49604 (forward-declared enum's elements in class scope gets default access (class vs struct)) 2017-05-12 Paolo Carlini PR c++/49604 * g++.dg/cpp0x/forw_enum14.C: New. * g++.dg/cpp0x/forw_enum15.C: Likewise. From-SVN: r247969 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/forw_enum14.C | 16 ++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/forw_enum15.C | 14 ++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum14.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/forw_enum15.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff4327a3734..4b9297b6c65 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-05-12 Paolo Carlini + + PR c++/49604 + * g++.dg/cpp0x/forw_enum14.C: New. + * g++.dg/cpp0x/forw_enum15.C: Likewise. + 2017-05-12 Richard Biener * 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 index 00000000000..ac38c183863 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum14.C @@ -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 index 00000000000..65816047432 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum15.C @@ -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" }