public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17395] New: Incorrect lookup for parameters
@ 2004-09-10 13:34 gdr at gcc dot gnu dot org
  2004-09-10 13:45 ` [Bug c++/17395] " gdr at integrable-solutions dot net
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-09-10 13:34 UTC (permalink / raw)
  To: gcc-bugs

G++ is confused about the scope of function paramaters.  
Here is a testcase

    template<int> struct X { };

    void fu(int a, X<sizeof(a)>) { }         // #1

    template<class T>
    void bhar(T a, X<sizeof(a)>) { }          // #2

    int main()
    {
       int x;
       X<sizeof(int)> y;
       fu(x, y);                             // #3
       bhar(x, y);                           // #4
    }

g++ erroneously rejects #1 and #2.

Notice that Comeau online accepts everything except #3 -- but
it should have accepted it.

-- 
           Summary: Incorrect lookup for parameters
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gdr at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: plateform independent


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
@ 2004-09-10 13:45 ` gdr at integrable-solutions dot net
  2004-09-10 14:19 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-09-10 13:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-09-10 13:45 -------
Subject: Re:  New: Incorrect lookup for parameters

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

[...]

|        bhar(x, y);                           // #4
|     }
| 
| g++ erroneously rejects #1 and #2.
| 
| Notice that Comeau online accepts everything except #3 -- but
                                                      ^^

that should read #4 -- my fingers typed in the wrong order.

-- Gaby


-- 


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
  2004-09-10 13:45 ` [Bug c++/17395] " gdr at integrable-solutions dot net
@ 2004-09-10 14:19 ` bangerth at dealii dot org
  2004-09-10 14:35 ` gdr at integrable-solutions dot net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-09-10 14:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-09-10 14:19 -------
I would guess gcc is right: the names of parameters can't be used 
in the rest of the argument list, can they? Note that this is 
different to template argument lists, in which this is explicitly 
allowed (and the standard writers felt the need to state so in a 
note). 
 
W. 

-- 


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
  2004-09-10 13:45 ` [Bug c++/17395] " gdr at integrable-solutions dot net
  2004-09-10 14:19 ` bangerth at dealii dot org
@ 2004-09-10 14:35 ` gdr at integrable-solutions dot net
  2004-09-10 14:41 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-09-10 14:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-09-10 14:35 -------
Subject: Re:  Incorrect lookup for parameters

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

| I would guess gcc is right:

No, GCC is wrong :-)
We had a thread on this issue on the Core reflector, no later than two
days ago.  John Spicer came with the following other example for which
GCC is  confused about.

   void* a = 0;
   void f(int a, int* b = a);

| the names of parameters can't be used 
| in the rest of the argument list, can they?

They can be used, except for specifying default arguments -- nothing
in the standard forbid that. The exemption for default arguments was
made explicit.  The rest follows from 3.3.1/1

   The point of declaration for a name is immediately after its
   complete declarator (clause 8) and before its initializer (if any),
   except as noted below. 

and below, there is no exemption for function parameters.

| Note that this is 
| different to template argument lists, in which this is explicitly 
| allowed (and the standard writers felt the need to state so in a 
| note). 

yes, I know. But I also checked with the stadard writers before
reporting the issue here :-)  That Comeau online is rejecting #4 is a bug
in EDG front-end -- which, as I understand it will be corrected.

-- Gaby


-- 


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-10 14:35 ` gdr at integrable-solutions dot net
@ 2004-09-10 14:41 ` bangerth at dealii dot org
  2004-12-10  3:08 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-09-10 14:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-09-10 14:35 -------
Subject: Re:  Incorrect lookup for parameters

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

| I would guess gcc is right:

No, GCC is wrong :-)
We had a thread on this issue on the Core reflector, no later than two
days ago.  John Spicer came with the following other example for which
GCC is  confused about.

   void* a = 0;
   void f(int a, int* b = a);

| the names of parameters can't be used 
| in the rest of the argument list, can they?

They can be used, except for specifying default arguments -- nothing
in the standard forbid that. The exemption for default arguments was
made explicit.  The rest follows from 3.3.1/1

   The point of declaration for a name is immediately after its
   complete declarator (clause 8) and before its initializer (if any),
   except as noted below. 

and below, there is no exemption for function parameters.

| Note that this is 
| different to template argument lists, in which this is explicitly 
| allowed (and the standard writers felt the need to state so in a 
| note). 

yes, I know. But I also checked with the stadard writers before
reporting the issue here :-)  That Comeau online is rejecting #4 is a bug
in EDG front-end -- which, as I understand it will be corrected.

-- Gaby

------- Additional Comments From bangerth at dealii dot org  2004-09-10 14:40 -------
> No, GCC is wrong :-) 
> We had a thread on this issue on the Core reflector, no later than two 
> days ago. 
 
Ah, I should have guessed :-) 
 
In that case, I think I should confirm the bug. 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-10 14:40:44
               date|                            |


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-10 14:41 ` bangerth at dealii dot org
@ 2004-12-10  3:08 ` pinskia at gcc dot gnu dot org
  2004-12-10  4:36 ` gdr at integrable-solutions dot net
  2004-12-10 13:37 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-10  3:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-09-10 14:40 -------
> No, GCC is wrong :-) 
> We had a thread on this issue on the Core reflector, no later than two 
> days ago. 
 
Ah, I should have guessed :-) 
 
In that case, I think I should confirm the bug. 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-10 14:40:44
               date|                            |
           What    |Removed                     |Added
----------------------------------------------------------------------------
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
   Last reconfirmed|2004-09-10 14:40:44         |2004-12-10 03:08:30
               date|                            |


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-12-10  3:08 ` pinskia at gcc dot gnu dot org
@ 2004-12-10  4:36 ` gdr at integrable-solutions dot net
  2004-12-10 13:37 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-12-10  4:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-12-10 04:36 -------
Subject: Re:  Incorrect lookup for parameters

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

| ------- Additional Comments From bangerth at dealii dot org  2004-09-10 14:40 -------
| > No, GCC is wrong :-) 
| > We had a thread on this issue on the Core reflector, no later than two 
| > days ago. 
|  
| Ah, I should have guessed :-) 
|  
| In that case, I think I should confirm the bug. 
| W. 

Is it normal that I get a mail from "pinskia" and signed "W."?

-- Gaby


-- 


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


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

* [Bug c++/17395] Incorrect lookup for parameters
  2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-12-10  4:36 ` gdr at integrable-solutions dot net
@ 2004-12-10 13:37 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-10 13:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-10 13:37 -------
(In reply to comment #5)
> Subject: Re:  Incorrect lookup for parameters
> 
> "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> 
> | ------- Additional Comments From bangerth at dealii dot org  2004-09-10 14:40 -------
> | > No, GCC is wrong :-) 
> | > We had a thread on this issue on the Core reflector, no later than two 
> | > days ago. 
> |  
> | Ah, I should have guessed :-) 
> |  
> | In that case, I think I should confirm the bug. 
> | W. 
> 
> Is it normal that I get a mail from "pinskia" and signed "W."?

What most likely happened is that bugzilla did not sent message before, so when I reconfirmed the 
bug, bugzilla sent out all of the pending messages for this bug.

-- 


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


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

end of thread, other threads:[~2004-12-10 13:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10 13:34 [Bug c++/17395] New: Incorrect lookup for parameters gdr at gcc dot gnu dot org
2004-09-10 13:45 ` [Bug c++/17395] " gdr at integrable-solutions dot net
2004-09-10 14:19 ` bangerth at dealii dot org
2004-09-10 14:35 ` gdr at integrable-solutions dot net
2004-09-10 14:41 ` bangerth at dealii dot org
2004-12-10  3:08 ` pinskia at gcc dot gnu dot org
2004-12-10  4:36 ` gdr at integrable-solutions dot net
2004-12-10 13:37 ` 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).