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
This commit is contained in:
Jakub Jelinek 2011-02-16 10:08:48 +01:00 committed by Jakub Jelinek
parent 503c8e860b
commit 4e3c0a153e
5 changed files with 28 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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
{

View file

@ -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.

View file

@ -0,0 +1,10 @@
// PR c++/47704
// { dg-do compile }
// { dg-options "-std=c++0x" }
void
foo ()
{
enum class E { A, B };
new E;
}