public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40749]  New: g++ doesnt report missing return if return is of type const <type>
@ 2009-07-14 17:13 mfribeiro at gmail dot com
  2009-07-15  9:37 ` [Bug c++/40749] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mfribeiro at gmail dot com @ 2009-07-14 17:13 UTC (permalink / raw)
  To: gcc-bugs

This code below wont generate a warning for function a(). Compiled with -Wall.
If you remove the const from the return, it will work.

<code>
class A {
public:
};

const A a() {
}

int main() {
  A b = a();
}
</code>


-- 
           Summary: g++ doesnt report missing return if return is of type
                    const <type>
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mfribeiro at gmail dot com
 GCC build triplet: x86_64 GNU/Linux
  GCC host triplet: x86_64 GNU/Linux
GCC target triplet: x86_64 GNU/Linux


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3/4.4/4.5 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
@ 2009-07-15  9:37 ` rguenth at gcc dot gnu dot org
  2009-07-17 19:57 ` simartin at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-15  9:37 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-07-15 09:37 -------
Confirmed.  4.2 reports

g++-4.2 -Wall t.C 
t.C: In function ‘const A a()’:
t.C:6: warning: control reaches end of non-void function


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |4.3.3 4.4.0 4.5.0
      Known to work|                            |4.2.4
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-15 09:37:13
               date|                            |
            Summary|g++ doesnt report missing   |[4.3/4.4/4.5 Regression] g++
                   |return if return is of type |doesnt report missing return
                   |const <type>                |if return is of type const
                   |                            |<type>
   Target Milestone|---                         |4.3.4


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3/4.4/4.5 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
  2009-07-15  9:37 ` [Bug c++/40749] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2009-07-17 19:57 ` simartin at gcc dot gnu dot org
  2009-07-17 22:03 ` simartin at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2009-07-17 19:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from simartin at gcc dot gnu dot org  2009-07-17 19:57 -------
It seems to be caused by the fix for PR#18313. I am testing the following:

Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c       (revision 149752)
+++ gcc/cp/decl.c       (working copy)
@@ -8314,12 +8314,14 @@
            if (type_quals != TYPE_UNQUALIFIED)
              {
                if (SCALAR_TYPE_P (type) || VOID_TYPE_P (type))
-                 warning (OPT_Wignored_qualifiers,
-                          "type qualifiers ignored on function return type");
+                 {
+                   warning (OPT_Wignored_qualifiers,
+                            "type qualifiers ignored on function return
type");
+                   set_no_warning = true;
+                 }
                /* 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)


-- 

simartin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simartin at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3/4.4/4.5 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
  2009-07-15  9:37 ` [Bug c++/40749] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
  2009-07-17 19:57 ` simartin at gcc dot gnu dot org
@ 2009-07-17 22:03 ` simartin at gcc dot gnu dot org
  2009-07-22 21:58 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2009-07-17 22:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from simartin at gcc dot gnu dot org  2009-07-17 22:03 -------
Updated patch submitted here:
  http://gcc.gnu.org/ml/gcc-patches/2009-07/msg01043.html


-- 

simartin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |simartin at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-07-15 09:37:13         |2009-07-17 22:03:33
               date|                            |


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3/4.4/4.5 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (2 preceding siblings ...)
  2009-07-17 22:03 ` simartin at gcc dot gnu dot org
@ 2009-07-22 21:58 ` rguenth at gcc dot gnu dot org
  2009-07-26  8:17 ` simartin at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-22 21:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3/4.4/4.5 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (3 preceding siblings ...)
  2009-07-22 21:58 ` rguenth at gcc dot gnu dot org
@ 2009-07-26  8:17 ` simartin at gcc dot gnu dot org
  2009-07-26 16:05 ` simartin at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2009-07-26  8:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from simartin at gcc dot gnu dot org  2009-07-26 08:16 -------
Subject: Bug 40749

Author: simartin
Date: Sun Jul 26 08:16:41 2009
New Revision: 150097

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150097
Log:
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.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wreturn-type-6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3/4.4/4.5 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (4 preceding siblings ...)
  2009-07-26  8:17 ` simartin at gcc dot gnu dot org
@ 2009-07-26 16:05 ` simartin at gcc dot gnu dot org
  2009-07-26 16:12 ` [Bug c++/40749] [4.3 " simartin at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2009-07-26 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from simartin at gcc dot gnu dot org  2009-07-26 16:05 -------
Subject: Bug 40749

Author: simartin
Date: Sun Jul 26 16:05:22 2009
New Revision: 150099

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150099
Log:
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.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/warn/Wreturn-type-6.C
Modified:
    branches/gcc-4_4-branch/gcc/cp/ChangeLog
    branches/gcc-4_4-branch/gcc/cp/decl.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (5 preceding siblings ...)
  2009-07-26 16:05 ` simartin at gcc dot gnu dot org
@ 2009-07-26 16:12 ` simartin at gcc dot gnu dot org
  2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simartin at gcc dot gnu dot org @ 2009-07-26 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from simartin at gcc dot gnu dot org  2009-07-26 16:11 -------
Fixed in 4.5 and 4.4. I don't plan to commit this to 4.3.


-- 

simartin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|simartin at gcc dot gnu dot |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW
      Known to fail|4.3.3 4.4.0 4.5.0           |4.3.3 4.4.0
      Known to work|4.2.4                       |4.2.4 4.4.2 4.5.0
            Summary|[4.3/4.4/4.5 Regression] g++|[4.3 Regression] g++ doesnt
                   |doesnt report missing return|report missing return if
                   |if return is of type const  |return is of type const
                   |<type>                      |<type>


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (6 preceding siblings ...)
  2009-07-26 16:12 ` [Bug c++/40749] [4.3 " simartin at gcc dot gnu dot org
@ 2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
  2009-12-26 13:54 ` paolo dot carlini at oracle dot com
  2009-12-26 21:50 ` paolo dot carlini at oracle dot com
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-08-04 12:30 -------
GCC 4.3.4 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.4                       |4.3.5


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (7 preceding siblings ...)
  2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
@ 2009-12-26 13:54 ` paolo dot carlini at oracle dot com
  2009-12-26 21:50 ` paolo dot carlini at oracle dot com
  9 siblings, 0 replies; 11+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-26 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from paolo dot carlini at oracle dot com  2009-12-26 13:53 -------
Will not be fixed in 4_3-branch.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.3.5                       |---


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c++/40749] [4.3 Regression] g++ doesnt report missing return if return is of type const <type>
  2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
                   ` (8 preceding siblings ...)
  2009-12-26 13:54 ` paolo dot carlini at oracle dot com
@ 2009-12-26 21:50 ` paolo dot carlini at oracle dot com
  9 siblings, 0 replies; 11+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-26 21:50 UTC (permalink / raw)
  To: gcc-bugs



-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.2


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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-12-26 21:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-14 17:13 [Bug c++/40749] New: g++ doesnt report missing return if return is of type const <type> mfribeiro at gmail dot com
2009-07-15  9:37 ` [Bug c++/40749] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
2009-07-17 19:57 ` simartin at gcc dot gnu dot org
2009-07-17 22:03 ` simartin at gcc dot gnu dot org
2009-07-22 21:58 ` rguenth at gcc dot gnu dot org
2009-07-26  8:17 ` simartin at gcc dot gnu dot org
2009-07-26 16:05 ` simartin at gcc dot gnu dot org
2009-07-26 16:12 ` [Bug c++/40749] [4.3 " simartin at gcc dot gnu dot org
2009-08-04 12:49 ` rguenth at gcc dot gnu dot org
2009-12-26 13:54 ` paolo dot carlini at oracle dot com
2009-12-26 21:50 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).