mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-13 14:11:18 +08:00
re PR c++/23689 (Malformed typedef silently ignored)
cp/: PR c++/23689 * decl.c (check_tag_decl): Added new warning for typedef ignored when it precedes an otherwise valid non-typedef declaration. testsuite/: 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. From-SVN: r122434
This commit is contained in:
parent
ceca734e8f
commit
41dc91a890
gcc
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -3694,6 +3694,8 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
|
||||
|| 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;
|
||||
|
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
@ -2,10 +2,8 @@
|
||||
|
||||
typedef struct S { // { dg-error "reference" }
|
||||
int &r;
|
||||
};
|
||||
}; // { dg-warning "'typedef' was ignored" }
|
||||
|
||||
S f () {
|
||||
return S (); // { dg-error "synthesized" }
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
// PR c++/18155
|
||||
|
||||
template<int> typedef struct A; // { dg-error "" }
|
||||
template<int> typedef struct A; // { dg-warning "'typedef' was ignored" }
|
||||
// { dg-error "" "" { target *-*-* } 3 }
|
||||
|
22
gcc/testsuite/g++.dg/warn/ignored_typedef.C
Normal file
22
gcc/testsuite/g++.dg/warn/ignored_typedef.C
Normal file
@ -0,0 +1,22 @@
|
||||
// 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" }
|
Loading…
x
Reference in New Issue
Block a user