re PR c++/13101 (incorrect warning on initialized extern const function pointer)
2008-07-11 Dodji Seketeli <dseketel@redhat.com> PR c++/13101 * decl.c (grokdeclarator): Warn about initializing variables of storage class 'extern' only after the type of the declarator has been properly computed. From-SVN: r137723
This commit is contained in:
parent
ec4d7730c8
commit
94eeabbe19
|
@ -1,3 +1,10 @@
|
|||
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
|
||||
|
||||
PR c++/13101
|
||||
* decl.c (grokdeclarator): Warn about initializing variables
|
||||
of storage class 'extern' only after the type of the declarator
|
||||
has been properly computed.
|
||||
|
||||
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
|
||||
|
||||
PR c++/31754
|
||||
|
@ -13,7 +20,8 @@
|
|||
cp_parser_type_specifier, cp_parser_simple_type_specifier,
|
||||
cp_parser_omp_for_loop, cp_parser_pragma): use location in error messages.
|
||||
|
||||
2008-06-30 Dodji Seketeli <dseketel@redhat.com>
|
||||
|
||||
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
|
||||
|
||||
PR c++/31754
|
||||
* pt.c, semantic.c:
|
||||
|
@ -148,7 +156,7 @@
|
|||
* pt.c: (tsubst_copy_and_build): Adjust.
|
||||
(unify): Handle { }.
|
||||
* name-lookup.c (arg_assoc_type): Handle init_list_type_node.
|
||||
|
||||
|
||||
2008-07-01 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* typeck.c (comp_ptr_ttypes_real): Use vector_targets_convertible_p.
|
||||
|
|
|
@ -8005,19 +8005,6 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
storage_class = sc_none;
|
||||
}
|
||||
}
|
||||
else if (storage_class == sc_extern && initialized
|
||||
&& !funcdef_flag)
|
||||
{
|
||||
if (toplevel_bindings_p ())
|
||||
{
|
||||
/* It's common practice (and completely valid) to have a const
|
||||
be initialized and declared extern. */
|
||||
if (!(type_quals & TYPE_QUAL_CONST))
|
||||
warning (0, "%qs initialized and declared %<extern%>", name);
|
||||
}
|
||||
else
|
||||
error ("%qs has both %<extern%> and initializer", name);
|
||||
}
|
||||
else if (storage_class == sc_extern && funcdef_flag
|
||||
&& ! toplevel_bindings_p ())
|
||||
error ("nested function %qs declared %<extern%>", name);
|
||||
|
@ -9236,6 +9223,19 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
}
|
||||
}
|
||||
|
||||
if (storage_class == sc_extern && initialized && !funcdef_flag)
|
||||
{
|
||||
if (toplevel_bindings_p ())
|
||||
{
|
||||
/* It's common practice (and completely valid) to have a const
|
||||
be initialized and declared extern. */
|
||||
if (!(type_quals & TYPE_QUAL_CONST))
|
||||
warning (0, "%qs initialized and declared %<extern%>", name);
|
||||
}
|
||||
else
|
||||
error ("%qs has both %<extern%> and initializer", name);
|
||||
}
|
||||
|
||||
/* Record `register' declaration for warnings on &
|
||||
and in case doing stupid register allocation. */
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
|
||||
|
||||
PR c++/13101
|
||||
* g++.dg/parse/func-ptr-decl.C: New test.
|
||||
* gcc/testsuite/g++.old-deja/g++.jason/crash11.C: Update this to
|
||||
catch a warning that is generated by virtue of fixing this bug.
|
||||
|
||||
2008-07-11 Dodji Seketeli <dseketel@redhat.com>
|
||||
|
||||
* g++.dg/other/semicolon.C: Tighten this test, making it column aware.
|
||||
|
|
|
@ -6,4 +6,4 @@ struct A {
|
|||
};
|
||||
const char foo[] = "bar";
|
||||
const A a = { foo };
|
||||
extern const A* ap = &a;
|
||||
extern const A* ap = &a; //{ dg-warning "warning: 'ap' initialized and declared 'extern'" }
|
||||
|
|
Loading…
Reference in New Issue