public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12427] New: Compiler misses error, gets lost. big time
@ 2003-09-27  0:47 igodard at pacbell dot net
  2003-09-27  0:57 ` [Bug c++/12427] " igodard at pacbell dot net
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: igodard at pacbell dot net @ 2003-09-27  0:47 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=12427

           Summary: Compiler misses error, gets lost. big time
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org

The actual problem in the test case is a missing constructor argument at testRecurrence.cc:38. Corrected, that line should say:
    Recurrence<std::bidirectional_iterator_tag, int, Inc, Dec> r3(0, Inc(),
        Dec());
and with that the code compiles without error. However, when the "0," argument is omitted as in the test case, the compiler fails to flag the error and gets way lost in later code.


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
@ 2003-09-27  0:57 ` igodard at pacbell dot net
  2003-09-27  0:58 ` igodard at pacbell dot net
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: igodard at pacbell dot net @ 2003-09-27  0: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=12427



------- Additional Comments From igodard at pacbell dot net  2003-09-26 22:19 -------
Created an attachment (id=4837)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4837&action=view)
Compiler output (-v -save-temps)


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
  2003-09-27  0:57 ` [Bug c++/12427] " igodard at pacbell dot net
@ 2003-09-27  0:58 ` igodard at pacbell dot net
  2003-09-27  6:36 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: igodard at pacbell dot net @ 2003-09-27  0: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=12427



------- Additional Comments From igodard at pacbell dot net  2003-09-26 22:21 -------
Created an attachment (id=4838)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4838&action=view)
Source code (-save-temps)


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
  2003-09-27  0:57 ` [Bug c++/12427] " igodard at pacbell dot net
  2003-09-27  0:58 ` igodard at pacbell dot net
@ 2003-09-27  6:36 ` pinskia at gcc dot gnu dot org
  2003-09-27 13:21 ` igodard at pacbell dot net
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-27  6:36 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=12427


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-27 05:40 -------
Not a bug:
        Recurrence<std::bidirectional_iterator_tag, int, Inc, Dec> r3(Inc(),
                Dec());

declares a function which takes the function pointer Inc (*)() and Dec (*) () as arguments 
and returns a Recurrence<std::bidirectional_iterator_tag, int, Inc, Dec>.
As the warning says:
Recurrence<std::bidirectional_iterator_tag, int, Inc, Dec> r3(Inc (*)(), Dec (*)()).


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (2 preceding siblings ...)
  2003-09-27  6:36 ` pinskia at gcc dot gnu dot org
@ 2003-09-27 13:21 ` igodard at pacbell dot net
  2003-09-27 15:22 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: igodard at pacbell dot net @ 2003-09-27 13: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=12427


igodard at pacbell dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


------- Additional Comments From igodard at pacbell dot net  2003-09-27 08:11 -------
Not the way I read it. Inc() and Dec() are the implicit null constructors of *class* Inc and Dec respectively, not function pointers. The function would be called Inc(*)() as you point out.

Hence Inc() and Dec() are temporary objects, not types. The syntax "type id(object1, object2)" can't be a function declaration, because that would require "type1 id(type2, type3)". Consequently it has to be a declaration of id as a type1 object with a constructor taking object1 and object2. But there is no such constructor, so there should have been an error.

The Standard says that ambiguity between a declaration and an expression is always broken by assuming declaration. But that rule doesn't apply here, because both of our interpretations have this as a declaration of r3 - the only difference is in the type of r3 as declared. The rule also doesn't apply to Inc() and Dec(), because neither of these are declarations: they are either constructor calls (me) or function type specifications (you).

Moreover, if we assume that your interpretation is right, then the corrected line with the additional 0 argument should not have compiled without error because "type id(0, type?, type?)" is certainly not a function declaration. Of course, I suppose that in that case the constructor would have been found and the function pointer interpretation rejected.

Also later on, what is the idea of the warning that an object has an *address* that always has the value *true*? That makes no sense to me, whether or not line 38 should have been reported. Is the compiler lost, or does this actually have some meaning?

Please re-examine.


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (3 preceding siblings ...)
  2003-09-27 13:21 ` igodard at pacbell dot net
@ 2003-09-27 15:22 ` gdr at integrable-solutions dot net
  2003-09-27 15:54 ` gdr at integrable-solutions dot net
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-09-27 15:22 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=12427



------- Additional Comments From gdr at integrable-solutions dot net  2003-09-27 10:15 -------
Subject: Re:  Compiler misses error, gets lost. big time

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Not a bug:
|         Recurrence<std::bidirectional_iterator_tag, int, Inc, Dec> r3(Inc(),
|                 Dec());
| 
| declares a function which takes the function pointer Inc (*)() and Dec (*) () as arguments 

Not quite right.  It declares a function named r3 taking an Inc and a
Dec and returns Recurrence<std::bidirectional_iterator_tag, int, Inc, Dec>.

(Note the parameter type are not pointer to functions).

-- Gaby


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (4 preceding siblings ...)
  2003-09-27 15:22 ` gdr at integrable-solutions dot net
@ 2003-09-27 15:54 ` gdr at integrable-solutions dot net
  2003-09-27 16:38 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-09-27 15:54 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=12427



------- Additional Comments From gdr at integrable-solutions dot net  2003-09-27 10:21 -------
Subject: Re:  Compiler misses error, gets lost. big time

"igodard at pacbell dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| Not the way I read it.

but you reading is wrong :-)

| Inc() and Dec() are the implicit null
| constructors of *class* Inc and Dec respectively, not function
| pointers. The function would be called Inc(*)() as you point out. 
| 
| Hence Inc() and Dec() are temporary objects, not types. The syntax
| "type id(object1, object2)" can't be a function declaration, because
| that would require "type1 id(type2, type3)". Consequently it has to
| be a declaration of id as a type1 object with a constructor taking
| object1 and object2. But there is no such constructor, so there
| should have been an error. 

This is an FAQ.  Have a look at 

          http://www.gotw.ca/gotw/075.htm

-- Gaby


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (5 preceding siblings ...)
  2003-09-27 15:54 ` gdr at integrable-solutions dot net
@ 2003-09-27 16:38 ` pinskia at gcc dot gnu dot org
  2003-09-27 20:25 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-27 16:38 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=12427


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-27 16:00 -------
Already shown to be invalid both by me and Gaby.


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (7 preceding siblings ...)
  2003-09-27 20:25 ` pinskia at gcc dot gnu dot org
@ 2003-09-27 20:25 ` igodard at pacbell dot net
  2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: igodard at pacbell dot net @ 2003-09-27 20:25 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=12427


igodard at pacbell dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


------- Additional Comments From igodard at pacbell dot net  2003-09-27 17:37 -------
OK, I'm convinced there's no error on line 38.

Now, what about the extremely odd warning? How can an address have the value true?

Ivan


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (6 preceding siblings ...)
  2003-09-27 16:38 ` pinskia at gcc dot gnu dot org
@ 2003-09-27 20:25 ` pinskia at gcc dot gnu dot org
  2003-09-27 20:25 ` igodard at pacbell dot net
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-27 20:25 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=12427


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-27 17:43 -------
Functions are the exception when it comes to having a "true" value as they are defined by the ISO 
C++ to be defined so the code can be optimized and not have reference to that function if need 
be.


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (9 preceding siblings ...)
  2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
@ 2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
  2004-08-17 10:49 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-17 10:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17 10:48 -------
Reopening to mark as a dup of ...

-- 


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


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (8 preceding siblings ...)
  2003-09-27 20:25 ` igodard at pacbell dot net
@ 2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
  2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
  2004-08-17 10:49 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-17 10:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17 10:48 -------
Reopen.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug c++/12427] Compiler misses error, gets lost. big time
  2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
                   ` (10 preceding siblings ...)
  2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
@ 2004-08-17 10:49 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-17 10:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-17 10:49 -------
And closing again, this time as a dup of bug 16347.

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

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


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


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

end of thread, other threads:[~2004-08-17 10:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-27  0:47 [Bug c++/12427] New: Compiler misses error, gets lost. big time igodard at pacbell dot net
2003-09-27  0:57 ` [Bug c++/12427] " igodard at pacbell dot net
2003-09-27  0:58 ` igodard at pacbell dot net
2003-09-27  6:36 ` pinskia at gcc dot gnu dot org
2003-09-27 13:21 ` igodard at pacbell dot net
2003-09-27 15:22 ` gdr at integrable-solutions dot net
2003-09-27 15:54 ` gdr at integrable-solutions dot net
2003-09-27 16:38 ` pinskia at gcc dot gnu dot org
2003-09-27 20:25 ` pinskia at gcc dot gnu dot org
2003-09-27 20:25 ` igodard at pacbell dot net
2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
2004-08-17 10:48 ` pinskia at gcc dot gnu dot org
2004-08-17 10:49 ` pinskia 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).