re PR c++/40749 (g++ doesnt report missing return if return is of type const <type>)
gcc/cp/ 2009-07-26 Simon Martin <simartin@users.sourceforge.net> PR c++/40749 * decl.c (grokdeclarator): Do not set TREE_NO_WARNING for functions with a qualified return type. gcc/testsuite/ 2007-07-26 Simon Martin <simartin@users.sourceforge.net> PR c++/40749 * g++.dg/warn/Wreturn-type-6.C: New test. From-SVN: r150097
This commit is contained in:
parent
63827fb8e2
commit
c2600c676c
@ -1,3 +1,9 @@
|
||||
2009-07-26 Simon Martin <simartin@users.sourceforge.net>
|
||||
|
||||
PR c++/40749
|
||||
* decl.c (grokdeclarator): Do not set TREE_NO_WARNING for functions
|
||||
with a qualified return type.
|
||||
|
||||
2009-07-24 Jason Merrill <jason@redhat.com>
|
||||
|
||||
Core issue 901
|
||||
|
@ -7636,7 +7636,6 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
bool unsigned_p, signed_p, short_p, long_p, thread_p;
|
||||
bool type_was_error_mark_node = false;
|
||||
bool parameter_pack_p = declarator? declarator->parameter_pack_p : false;
|
||||
bool set_no_warning = false;
|
||||
bool template_type_arg = false;
|
||||
const char *errmsg;
|
||||
|
||||
@ -8316,7 +8315,6 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
/* We now know that the TYPE_QUALS don't apply to the
|
||||
decl, but to its return type. */
|
||||
type_quals = TYPE_UNQUALIFIED;
|
||||
set_no_warning = true;
|
||||
}
|
||||
errmsg = targetm.invalid_return_type (type);
|
||||
if (errmsg)
|
||||
@ -9538,9 +9536,6 @@ grokdeclarator (const cp_declarator *declarator,
|
||||
if (!processing_template_decl)
|
||||
cp_apply_type_quals_to_decl (type_quals, decl);
|
||||
|
||||
if (set_no_warning)
|
||||
TREE_NO_WARNING (decl) = 1;
|
||||
|
||||
return decl;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-07-26 Simon Martin <simartin@users.sourceforge.net>
|
||||
|
||||
PR c++/40749
|
||||
* g++.dg/warn/Wreturn-type-6.C: New test.
|
||||
|
||||
2009-07-26 Ira Rosen <irar@il.ibm.com>
|
||||
|
||||
PR tree-optimization/40801
|
||||
|
13
gcc/testsuite/g++.dg/warn/Wreturn-type-6.C
Normal file
13
gcc/testsuite/g++.dg/warn/Wreturn-type-6.C
Normal file
@ -0,0 +1,13 @@
|
||||
/* PR c++/40749 */
|
||||
/* { dg-do "compile" } */
|
||||
/* { dg-options "-Wreturn-type" } */
|
||||
|
||||
struct A {};
|
||||
const A a() {} /* { dg-warning "no return statement" } */
|
||||
const A& b() {} /* { dg-warning "no return statement" } */
|
||||
|
||||
const int c() {} /* { dg-warning "no return statement" } */
|
||||
|
||||
template<class T>
|
||||
const int foo(T t) {} /* { dg-warning "no return statement" } */
|
||||
int d = foo<int>(0), e = foo<int>(1);
|
Loading…
x
Reference in New Issue
Block a user