Commit 1039d00c by Paolo Carlini Committed by Paolo Carlini

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
parent 590f447b
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
......
......@@ -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))
......
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.
2018-12-15 Jakub Jelinek <jakub@redhat.com>
PR target/88489
......
......@@ -2,5 +2,5 @@
// PR c++/33838
template<typename T> struct A
{
__decltype (T* foo()); // { dg-error "expected|no arguments|accept" }
__decltype (T* foo()); // { dg-error "expected|no arguments|declaration" }
};
// PR c++/84644
// { dg-do compile { target c++11 } }
template<int a>
struct b {
decltype(a) __attribute__((break)); // { dg-error "declaration does not declare anything" }
};
......@@ -2,5 +2,5 @@
struct A
{
template<template<int> class B> struct B<0>; // { dg-error "name of class shadows" }
template<template<int> class B> struct B<0>; // { dg-error "declaration does not declare anything" }
};
......@@ -2,7 +2,7 @@
// { dg-do compile }
template<template<int> class A>
class A<0>; // { dg-error "shadows template template parameter" }
class A<0>; // { dg-error "declaration does not declare anything" }
template<template<int> class B>
class B<0> {}; // { dg-error "shadows template template parameter" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment