aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2018-12-15 09:07:38 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2018-12-15 09:07:38 +0000
commit1039d00c597ece034f51a66d085fa80f1f11d9e2 (patch)
treec6d0a9f9ff6ad1c4a868f8af6bfe1c20b3f41b96 /gcc/cp
parent590f447b7027c218a11df8434569135abf450747 (diff)
downloadgcc-1039d00c597ece034f51a66d085fa80f1f11d9e2.zip
gcc-1039d00c597ece034f51a66d085fa80f1f11d9e2.tar.gz
gcc-1039d00c597ece034f51a66d085fa80f1f11d9e2.tar.bz2
re PR c++/84644 (internal compiler error: in warn_misplaced_attr_for_class_type, at cp/decl.c:4718)
/cp 2018-12-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84644 * decl.c (check_tag_decl): A decltype with no declarator doesn't declare anything. /testsuite 2018-12-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84644 * g++.dg/cpp0x/decltype68.C: New. * g++.dg/cpp0x/decltype-33838.C: Adjust. * g++.dg/template/spec32.C: Likewise. * g++.dg/template/ttp22.C: Likewise. From-SVN: r267165
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2dfb1fe..ee9e570 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/84644
+ * decl.c (check_tag_decl): A decltype with no declarator
+ doesn't declare anything.
+
2018-12-14 Alexandre Oliva <aoliva@redhat.com>
PR c++/87814
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5435ef2..d6028e3 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4803,15 +4803,20 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
declared_type = declspecs->type;
else if (declspecs->type == error_mark_node)
error_p = true;
- if (declared_type == NULL_TREE && ! saw_friend && !error_p)
- permerror (input_location, "declaration does not declare anything");
- else if (declared_type != NULL_TREE && type_uses_auto (declared_type))
+
+ if (type_uses_auto (declared_type))
{
error_at (declspecs->locations[ds_type_spec],
"%<auto%> can only be specified for variables "
"or function declarations");
return error_mark_node;
}
+
+ if (declared_type && !OVERLOAD_TYPE_P (declared_type))
+ declared_type = NULL_TREE;
+
+ if (!declared_type && !saw_friend && !error_p)
+ permerror (input_location, "declaration does not declare anything");
/* Check for an anonymous union. */
else if (declared_type && RECORD_OR_UNION_CODE_P (TREE_CODE (declared_type))
&& TYPE_UNNAMED_P (declared_type))