+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
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
// 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" }
};
--- /dev/null
+// 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" }
+};
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" }
};
// { 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" }