diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-02-16 10:08:48 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-02-16 10:08:48 +0100 |
commit | 4e3c0a153e1b0f94c5858911b8492496b61145b7 (patch) | |
tree | 914af06cb410c0ea1c590a9aebcd56b42b67b7b5 | |
parent | 503c8e860b28659ab922f8500590d08353c0575c (diff) | |
download | gcc-4e3c0a153e1b0f94c5858911b8492496b61145b7.zip gcc-4e3c0a153e1b0f94c5858911b8492496b61145b7.tar.gz gcc-4e3c0a153e1b0f94c5858911b8492496b61145b7.tar.bz2 |
re PR c++/47704 ([C++0x] Java-related error message when trying to instantiate a strongly typed enum with new)
PR c++/47704
* cp-tree.h (ENUM_FIXED_UNDERLYING_TYPE_P): Use TYPE_LANG_FLAG_5
instead of TYPE_LANG_FLAG_3.
* pt.c (lookup_template_class): Copy over
ENUM_FIXED_UNDERLYING_TYPE_P.
* g++.dg/cpp0x/enum8.C: New test.
From-SVN: r170209
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/enum8.C | 10 |
5 files changed, 28 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0fdac3c..d2972eb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2011-02-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/47704 + * cp-tree.h (ENUM_FIXED_UNDERLYING_TYPE_P): Use TYPE_LANG_FLAG_5 + instead of TYPE_LANG_FLAG_3. + * pt.c (lookup_template_class): Copy over + ENUM_FIXED_UNDERLYING_TYPE_P. + 2011-02-15 Jason Merrill <jason@redhat.com> PR c++/46807 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 934dab8..238d0cf 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1,6 +1,6 @@ /* Definitions for C++ parsing and type checking. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) @@ -115,6 +115,7 @@ c-common.h, not after. 3: TYPE_FOR_JAVA. 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR 5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE) + ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE) 6: TYPE_DEPENDENT_P_VALID Usage of DECL_LANG_FLAG_?: @@ -3098,7 +3099,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* Determines whether an ENUMERAL_TYPE has an explicit underlying type. */ -#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_3 (NODE)) +#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE)) /* Returns the underlying type of the given enumeration type. The underlying type is determined in different ways, depending on the diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d59f32a..fe3e954 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6993,6 +6993,8 @@ lookup_template_class (tree d1, SET_SCOPED_ENUM_P (t, SCOPED_ENUM_P (template_type)); } SET_OPAQUE_ENUM_P (t, OPAQUE_ENUM_P (template_type)); + ENUM_FIXED_UNDERLYING_TYPE_P (t) + = ENUM_FIXED_UNDERLYING_TYPE_P (template_type); } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2608ce5..619292c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/47704 + * g++.dg/cpp0x/enum8.C: New test. + 2011-02-15 Jason Merrill <jason@redhat.com> * g++.dg/inherit/implicit-trivial1.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/enum8.C b/gcc/testsuite/g++.dg/cpp0x/enum8.C new file mode 100644 index 0000000..0075e2d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum8.C @@ -0,0 +1,10 @@ +// PR c++/47704 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +void +foo () +{ + enum class E { A, B }; + new E; +} |