[Bug c++/18969] Invalid return statement diagnosed too late

2015-07-26 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18969

--- Comment #5 from Patrick Palka ppalka at gcc dot gnu.org ---
Author: ppalka
Date: Sun Jul 26 17:04:31 2015
New Revision: 226236

URL: https://gcc.gnu.org/viewcvs?rev=226236root=gccview=rev
Log:
Fix PR c++/18969 (invalid return statement diagnosed too late)

gcc/cp/ChangeLog:

PR c++/18969
* typeck.c (check_return_expr): Also do the basic return-value
validity checking if processing_template_decl and yet types are
not dependent.  Remove obsolete code.

gcc/testsuite/ChangeLog:

PR c++/18969
* g++.dg/template/pr18969.C: New test.
* g++.dg/template/pr18969-2.C: New test.
* g++.old-deja/g++.jason/overload.C: Remove return value in
template function returning void.


Added:
trunk/gcc/testsuite/g++.dg/template/pr18969-2.C
trunk/gcc/testsuite/g++.dg/template/pr18969.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.old-deja/g++.jason/overload.C


[Bug c++/18969] Invalid return statement diagnosed too late

2015-07-26 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18969

Patrick Palka ppalka at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ppalka at gcc dot gnu.org
 Resolution|--- |FIXED
   Target Milestone|--- |6.0

--- Comment #6 from Patrick Palka ppalka at gcc dot gnu.org ---
Fixed.


[Bug c++/18969] Invalid return statement diagnosed too late

2013-11-07 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18969

--- Comment #3 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
It works in clang:

test.cc:3:16: error: void function 'foo' should not return a value
[-Wreturn-type]
  void foo() { return 0; }
   ^  ~

[Bug c++/18969] Invalid return statement diagnosed too late

2013-11-07 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18969

--- Comment #4 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Breakpoint 5, check_return_expr (retval=integer_cst 0x77408720,
no_warning=0x7fffdf2f) at /home/manuel/test1/src/gcc/cp/typeck.c:8311

B =if (processing_template_decl)
  {
current_function_returns_value = 1;
if (check_for_bare_parameter_packs (retval))
  retval = error_mark_node;
return retval;
  }

processing_template_decl is a big hammer here. We only should care about the
return type of the function or the type of the thing being returned. If those
are not dependent, then we should just give diagnostics. But we also need a way
to not repeat the diagnostics when instantiated.

It doesn't seem trivial to me.

[Bug c++/18969] Invalid return statement diagnosed too late

2006-04-14 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2006-04-14 21:03 ---
*** Bug 27167 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||doug dot gregor at gmail dot
   ||com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18969



[Bug c++/18969] Invalid return statement diagnosed too late

2004-12-13 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-13 
21:36 ---
Confirmed.

-- 
   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
  Known to fail||3.3.2 4.0.0
   Last reconfirmed|-00-00 00:00:00 |2004-12-13 21:36:31
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18969