diff options
author | Jason Merrill <jason@redhat.com> | 2009-11-19 22:12:07 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-11-19 22:12:07 -0500 |
commit | 98fba7f7af1ee1286264f56447be91a4a8e67d49 (patch) | |
tree | 63905b727771eafda1e6f825efab72f97791999e /gcc/cp | |
parent | 2fc9ae768b23d157adf13dacf8e929a2aaec6cd5 (diff) | |
download | gcc-98fba7f7af1ee1286264f56447be91a4a8e67d49.zip gcc-98fba7f7af1ee1286264f56447be91a4a8e67d49.tar.gz gcc-98fba7f7af1ee1286264f56447be91a4a8e67d49.tar.bz2 |
DR 176 permissiveness
DR 176 permissiveness
gcc/
* dwarf2out.c (get_context_die): Take TYPE_MAIN_VARIANT.
gcc/cp/
* class.c (build_self_reference): Call set_underlying_type.
* decl.c (check_elaborated_type_specifier): Don't complain about
injected-class-name.
(type_is_deprecated): Use TYPE_MAIN_VARIANT.
* pt.c (convert_template_argument): Handle injected-class-name used
as template template argument.
* typeck2.c (abstract_virtuals_error): Use TYPE_MAIN_VARIANT.
From-SVN: r154354
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/class.c | 1 | ||||
-rw-r--r-- | gcc/cp/decl.c | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 16 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 1 |
5 files changed, 32 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6a30b67..c25d360 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,14 @@ 2009-11-19 Jason Merrill <jason@redhat.com> + DR 176 permissiveness + * class.c (build_self_reference): Call set_underlying_type. + * decl.c (check_elaborated_type_specifier): Don't complain about + injected-class-name. + (type_is_deprecated): Use TYPE_MAIN_VARIANT. + * pt.c (convert_template_argument): Handle injected-class-name used + as template template argument. + * typeck2.c (abstract_virtuals_error): Use TYPE_MAIN_VARIANT. + PR c++/561 * decl.c (static_fn_type): Split out... (revert_static_member_fn): ...from here. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 3cf15fb..38eb73f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6513,6 +6513,7 @@ build_self_reference (void) DECL_CONTEXT (value) = current_class_type; DECL_ARTIFICIAL (value) = 1; SET_DECL_SELF_REFERENCE_P (value); + set_underlying_type (value); if (processing_template_decl) value = push_template_decl (value); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 29e32c8..7f5a688 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9787,6 +9787,10 @@ type_is_deprecated (tree type) && TREE_DEPRECATED (TYPE_NAME (type))) return type; + /* Do warn about using typedefs to a deprecated class. */ + if (TAGGED_TYPE_P (type) && type != TYPE_MAIN_VARIANT (type)) + return type_is_deprecated (TYPE_MAIN_VARIANT (type)); + code = TREE_CODE (type); if (code == POINTER_TYPE || code == REFERENCE_TYPE @@ -10608,6 +10612,7 @@ check_elaborated_type_specifier (enum tag_types tag_code, elaborated type specifier is the implicit typedef created when the type is declared. */ else if (!DECL_IMPLICIT_TYPEDEF_P (decl) + && !DECL_SELF_REFERENCE_P (decl) && tag_code != typename_type) { error ("using typedef-name %qD after %qs", decl, tag_name (tag_code)); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9c82e3c..c3b0f0e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5370,6 +5370,22 @@ convert_template_argument (tree parm, if (TREE_CODE (arg) == TYPE_PACK_EXPANSION) arg = PACK_EXPANSION_PATTERN (arg); + /* Deal with an injected-class-name used as a template template arg. */ + if (requires_tmpl_type && CLASS_TYPE_P (arg)) + { + tree t = maybe_get_template_decl_from_type_decl (TYPE_NAME (arg)); + if (TREE_CODE (t) == TEMPLATE_DECL) + { + if (complain & tf_warning_or_error) + pedwarn (input_location, OPT_pedantic, "injected-class-name %qD" + " used as template template argument", TYPE_NAME (arg)); + else if (flag_pedantic_errors) + t = arg; + + arg = t; + } + } + is_tmpl_type = ((TREE_CODE (arg) == TEMPLATE_DECL && TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 6cb1152..a296caa 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -236,6 +236,7 @@ abstract_virtuals_error (tree decl, tree type) be abstract. */ if (!CLASS_TYPE_P (type)) return 0; + type = TYPE_MAIN_VARIANT (type); /* If the type is incomplete, we register it within a hash table, so that we can check again once it is completed. This makes sense |