+2007-03-01 Simon Baldwin <simonb@google.com>
+
+ PR c++/23689
+ * decl.c (check_tag_decl): Added new warning for typedef ignored
+ when it precedes an otherwise valid non-typedef declaration.
+
2007-02-28 Sandra Loosemore <sandra@codesourcery.com>
* typeck.c (build_function_call): Store converted arguments
|| declspecs->specs[(int)ds_thread])
error ("qualifiers can only be specified for objects "
"and functions");
+ else if (saw_typedef)
+ warning (0, "%<typedef%> was ignored in this declaration");
}
return declared_type;
+2007-03-01 Simon Baldwin <simonb@google.com>
+
+ PR c++/23689
+ * warn/ignored_typedef.C: New.
+ * init/ctor8.C: Added dg-warning to consume ignored typedef
+ warning.
+ * template/typedef2.C: Ditto. Moved dg-error onto its own line
+ and added an explicit line number.
+
2007-02-28 Richard Guenther <rguenther@suse.de>
PR middle-end/30364
typedef struct S { // { dg-error "reference" }
int &r;
-};
+}; // { dg-warning "'typedef' was ignored" }
S f () {
return S (); // { dg-error "synthesized" }
}
-
-
// PR c++/18155
-template<int> typedef struct A; // { dg-error "" }
+template<int> typedef struct A; // { dg-warning "'typedef' was ignored" }
+ // { dg-error "" "" { target *-*-* } 3 }
--- /dev/null
+// PR c++/23689
+// Test that malformed typedef's produce a compiler warning.
+
+typedef char valid_0;
+typedef int valid_1;
+typedef long valid_2;
+typedef float valid_3;
+typedef double valid_4;
+typedef unsigned valid_5;
+typedef int *valid_6;
+typedef struct valid_7 {} valid_8;
+typedef struct {} valid_9;
+typedef int temp_0; typedef temp_0 valid_10;
+struct temp_1 {}; typedef temp_1 valid_11;
+union temp_2 {}; typedef temp_2 valid_12;
+typedef void (*valid_13) (int);
+
+typedef struct invalid_0 {}; // { dg-warning "'typedef' was ignored" }
+typedef class invalid_1 {}; // { dg-warning "'typedef' was ignored" }
+typedef enum invalid_2 { INVALID_2 }; // { dg-warning "'typedef' was ignored" }
+typedef enum { INVALID_3 }; // { dg-warning "'typedef' was ignored" }
+typedef union invalid_4 {}; // { dg-warning "'typedef' was ignored" }