public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates
@ 2003-08-16  9:21 gerald at pfeifer dot com
  2003-08-16 11:49 ` [Bug c++/11945] [3.4 Regression] " lerdsuwa at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gerald at pfeifer dot com @ 2003-08-16  9:21 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Incorrect warnings issued for comma-expressions inside
                    templates
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gerald at pfeifer dot com
                CC: gcc-bugs at gcc dot gnu dot org

This bug only happens inside a template class or a template function,
but not inside a regular function.

Compile the following with g++ -W

  extern "C" void FormatDisk();
  template <class T>
  struct C {
    C(){ FormatDisk(), 0; }  // extraneous warning
  };
  template <class T>
  void f() { FormatDisk(), 0; } // extraneious warning
  void g() { FormatDisk(), 0; }

Incorrect warnings (Formatting a disk _is_ an effect, isn't it)?
  x.cc: In constructor `C<T>::C()':
  x.cc:4: warning: left-hand operand of comma expression has no effect
  x.cc: In function `void f()':
  x.cc:7: warning: left-hand operand of comma expression has no effect

This is a regression introduced around 2003-07-08, probably by Mark (according
to educated guesses using ChangeLogs and `cvs annotate`).

It is especially bad, as Solaris system headers use constructs like this.


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

* [Bug c++/11945] [3.4 Regression] Incorrect warnings issued for comma-expressions inside templates
  2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
@ 2003-08-16 11:49 ` lerdsuwa at gcc dot gnu dot org
  2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-08-16 11:49 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


lerdsuwa at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-16 11:49:45
               date|                            |
            Summary|Incorrect warnings issued   |[3.4 Regression] Incorrect
                   |for comma-expressions inside|warnings issued for comma-
                   |templates                   |expressions inside templates


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2003-08-16 11:49 -------
Confirmed as a regression from 3.3.


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

* [Bug c++/11945] [3.4 Regression] Incorrect warnings issued for comma-expressions inside templates
  2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
  2003-08-16 11:49 ` [Bug c++/11945] [3.4 Regression] " lerdsuwa at gcc dot gnu dot org
@ 2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
  2003-08-18 10:12 ` gerald at pfeifer dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-16 12:43 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-16 12:43 -------
This is a dup of bug 11512.

*** This bug has been marked as a duplicate of 11512 ***


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

* [Bug c++/11945] [3.4 Regression] Incorrect warnings issued for comma-expressions inside templates
  2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
  2003-08-16 11:49 ` [Bug c++/11945] [3.4 Regression] " lerdsuwa at gcc dot gnu dot org
  2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
@ 2003-08-18 10:12 ` gerald at pfeifer dot com
  2003-08-18 12:57 ` nathan at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gerald at pfeifer dot com @ 2003-08-18 10:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


gerald at pfeifer dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


------- Additional Comments From gerald at pfeifer dot com  2003-08-18 10:12 -------
This is not a real duplicate, in that the fix for PR11512 causes problems with
the testcase of this PR:

 % gccvs x.cc -c -Wall
 x.cc: In function `void g()':
 x.cc:11: warning: right-hand operand of comma has no effect

If don't think we should warn in this case, but _if_ we do, we should
consistenly warn in all three cases, not just the ones involving templates.


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

* [Bug c++/11945] [3.4 Regression] Incorrect warnings issued for comma-expressions inside templates
  2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
                   ` (2 preceding siblings ...)
  2003-08-18 10:12 ` gerald at pfeifer dot com
@ 2003-08-18 12:57 ` nathan at gcc dot gnu dot org
  2003-08-20 17:58 ` nathan at gcc dot gnu dot org
  2003-08-20 18:00 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-08-18 12:57 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|REOPENED                    |ASSIGNED


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

* [Bug c++/11945] [3.4 Regression] Incorrect warnings issued for comma-expressions inside templates
  2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
                   ` (3 preceding siblings ...)
  2003-08-18 12:57 ` nathan at gcc dot gnu dot org
@ 2003-08-20 17:58 ` nathan at gcc dot gnu dot org
  2003-08-20 18:00 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-08-20 17:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From nathan at gcc dot gnu dot org  2003-08-20 17:58 -------
2003-08-19  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/11945
	* pt.c (build_non_dependent_expr): Look inside COND_EXPR and
	COMPOUND_EXPR.
	* semantics.c (finish_expr_stmt): Always convert to void.
	* typeck.c (build_x_compound_exp): Always convert to void.


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

* [Bug c++/11945] [3.4 Regression] Incorrect warnings issued for comma-expressions inside templates
  2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
                   ` (4 preceding siblings ...)
  2003-08-20 17:58 ` nathan at gcc dot gnu dot org
@ 2003-08-20 18:00 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-08-20 18:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-08-20 18:00 -------
Subject: Bug 11945

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2003-08-20 18:00:09

Modified files:
	gcc/cp         : ChangeLog pt.c semantics.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/warn: noeffect2.C 

Log message:
	cp:
	PR c++/11945
	* pt.c (build_non_dependent_expr): Look inside COND_EXPR and
	COMPOUND_EXPR.
	* semantics.c (finish_expr_stmt): Always convert to void.
	* typeck.c (build_x_compound_exp): Always convert to void.
	testsuite:
	PR c++/11945
	* g++.dg/warn/noeffect2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3612&r2=1.3613
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.761&r2=1.762
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.348&r2=1.349
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.493&r2=1.494
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2982&r2=1.2983
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/noeffect2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

end of thread, other threads:[~2003-08-20 18:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-16  9:21 [Bug c++/11945] New: Incorrect warnings issued for comma-expressions inside templates gerald at pfeifer dot com
2003-08-16 11:49 ` [Bug c++/11945] [3.4 Regression] " lerdsuwa at gcc dot gnu dot org
2003-08-16 12:43 ` pinskia at gcc dot gnu dot org
2003-08-18 10:12 ` gerald at pfeifer dot com
2003-08-18 12:57 ` nathan at gcc dot gnu dot org
2003-08-20 17:58 ` nathan at gcc dot gnu dot org
2003-08-20 18:00 ` cvs-commit at gcc dot gnu dot org

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).