public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17585] New: g++ generates errors on a legal code.
@ 2004-09-21 14:48 tal dot agmon at nsc dot com
  2004-09-21 14:56 ` [Bug c++/17585] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: tal dot agmon at nsc dot com @ 2004-09-21 14:48 UTC (permalink / raw)
  To: gcc-bugs

Compile the following code with g++ creates the following errors:

template <void (*p)(void)> struct S03 {};
class C03 {
public:
        static void f(void) {}
	void g(void) { S03<&f> s03; }
};

In member function `void C03::g()':
error: missing `>' to terminate the template argument list
error: template argument 1 is invalid
error: expected `;' before "f"

-- 
           Summary: g++ generates errors on a legal code.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tal dot agmon at nsc dot com
                CC: gcc-bugs at gcc dot gnu dot org,paul dot woegerer at nsc
                    dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/17585] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
@ 2004-09-21 14:56 ` pinskia at gcc dot gnu dot org
  2004-09-21 15:03 ` tal dot agmon at nsc dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-21 14:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-21 14:56 -------
Doing 03<(&f)> s03; or 03<f> s03; instead I get:
t.cc:6: error: `static void C03::f()' cannot appear in a constant-expression
t.cc:6: error: `&' cannot appear in a constant-expression
t.cc:6: error: template argument 1 is invalid
t.cc:6: error: invalid type in declaration before ';' token

So this is actually invalid code.

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


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


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

* [Bug c++/17585] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
  2004-09-21 14:56 ` [Bug c++/17585] " pinskia at gcc dot gnu dot org
@ 2004-09-21 15:03 ` tal dot agmon at nsc dot com
  2004-09-21 18:56 ` bangerth at dealii dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tal dot agmon at nsc dot com @ 2004-09-21 15:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tal dot agmon at nsc dot com  2004-09-21 15:03 -------
>From the ANSI-C++ chapter 9.4 Static members:

"A static member s of class X may be referred to using the qualified id
expression X::s; it is not necessary to use the class member access syntax 
(5.2.5) to refer to a static member."
"A static member may be referred to directly in the scope of its class or in 
the scope of a class derived (clause 10) from its class"

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


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


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

* [Bug c++/17585] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
  2004-09-21 14:56 ` [Bug c++/17585] " pinskia at gcc dot gnu dot org
  2004-09-21 15:03 ` tal dot agmon at nsc dot com
@ 2004-09-21 18:56 ` bangerth at dealii dot org
  2004-09-22  7:22 ` tal dot agmon at nsc dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bangerth at dealii dot org @ 2004-09-21 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-09-21 18:56 -------
The correct syntax is 
        void g(void) { S03<&C03::f> s03; } 
With that it compiles cleanly. 
 
W. 

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


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


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

* [Bug c++/17585] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (2 preceding siblings ...)
  2004-09-21 18:56 ` bangerth at dealii dot org
@ 2004-09-22  7:22 ` tal dot agmon at nsc dot com
  2004-09-22  8:44 ` giovannibajo at libero dot it
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tal dot agmon at nsc dot com @ 2004-09-22  7:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tal dot agmon at nsc dot com  2004-09-22 07:22 -------
According to my quotes from the ANSI-C++ the following syntax is valid:
void g(void) { S03<&f> s03; }

However, the compiler issues errors.
If someone thinks that this is an invalid code, please provide some proof.



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


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


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

* [Bug c++/17585] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (3 preceding siblings ...)
  2004-09-22  7:22 ` tal dot agmon at nsc dot com
@ 2004-09-22  8:44 ` giovannibajo at libero dot it
  2004-09-24 13:08 ` [Bug c++/17585] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: giovannibajo at libero dot it @ 2004-09-22  8:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-09-22 08:43 -------
I won't confirm it right now, but Tal is right: the standard my not appear 
clear but the syntax &A::f is used to form pointers to members: a pointer to a 
static member function is not a pointer to member, it is a regulard pointer to 
function. [conv.func]/1 (footnote 50) says that "&f" is forbidden for non-
static member function, and it implies that "f" is a regular lvalue for a 
static member function.


-- 


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (4 preceding siblings ...)
  2004-09-22  8:44 ` giovannibajo at libero dot it
@ 2004-09-24 13:08 ` pinskia at gcc dot gnu dot org
  2004-09-24 23:13 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 13:08 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
            Summary|g++ generates errors on a   |[3.4/4.0 Regression] g++
                   |legal code.                 |generates errors on a legal
                   |                            |code.
   Target Milestone|---                         |3.4.3


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (5 preceding siblings ...)
  2004-09-24 13:08 ` [Bug c++/17585] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-09-24 23:13 ` mmitchel at gcc dot gnu dot org
  2004-09-27 14:47 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-09-24 23:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-09-24 23:13 -------
Working on a fix.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (6 preceding siblings ...)
  2004-09-24 23:13 ` mmitchel at gcc dot gnu dot org
@ 2004-09-27 14:47 ` cvs-commit at gcc dot gnu dot org
  2004-09-27 18:47 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-27 14:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-27 14:47 -------
Subject: Bug 17585

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-09-27 14:46:56

Modified files:
	gcc/cp         : ChangeLog semantics.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: static8.C 

Log message:
	PR c++/17585
	* semantics.c (finish_id_expression): Do not add "this->" to
	static member functions.
	
	PR c++/17585
	* g++.dg/template/static8.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4387&r2=1.4388
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.438&r2=1.439
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4356&r2=1.4357
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (7 preceding siblings ...)
  2004-09-27 14:47 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-27 18:47 ` cvs-commit at gcc dot gnu dot org
  2004-09-27 18:50 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-27 18:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-27 18:47 -------
Subject: Bug 17585

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-09-27 18:47:30

Modified files:
	gcc/cp         : ChangeLog cp-tree.h search.c semantics.c 

Log message:
	PR c++/17585
	* cp-tree.h (shared_member_p): Declare.
	* search.c (shared_member_p): Give it external linkage.
	* semantics.c (finish_qualified_id_expr): Use it.
	(finish_id_expression): Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4388&r2=1.4389
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1053&r2=1.1054
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.323&r2=1.324
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.439&r2=1.440



-- 


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (8 preceding siblings ...)
  2004-09-27 18:47 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-27 18:50 ` cvs-commit at gcc dot gnu dot org
  2004-09-27 21:14 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-27 18:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-27 18:50 -------
Subject: Bug 17585

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-09-27 18:50:24

Modified files:
	gcc/cp         : ChangeLog cp-tree.h search.c semantics.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: error18.C 
	gcc/testsuite/g++.dg/template: static8.C 

Log message:
	PR c++/17585
	* cp-tree.h (shared_member_p): Declare.
	* search.c (shared_member_p): Give it external linkage.
	* semantics.c (finish_qualified_id_expr): Use it.
	(finish_id_expression): Likewise.
	
	PR c++/17585
	* g++.dg/template/static8.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.160&r2=1.3892.2.161
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.946.4.15&r2=1.946.4.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.284.4.4&r2=1.284.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.381.4.14&r2=1.381.4.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.274&r2=1.3389.2.275
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error18.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static8.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (9 preceding siblings ...)
  2004-09-27 18:50 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-27 21:14 ` mmitchel at gcc dot gnu dot org
  2004-09-30 18:02 ` pinskia at gcc dot gnu dot org
  2004-09-30 18:13 ` benh at bwsint dot com
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-09-27 21:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-09-27 21:14 -------
Fixed in GCC 3.4.3.

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


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (10 preceding siblings ...)
  2004-09-27 21:14 ` mmitchel at gcc dot gnu dot org
@ 2004-09-30 18:02 ` pinskia at gcc dot gnu dot org
  2004-09-30 18:13 ` benh at bwsint dot com
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-30 18:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-30 18:02 -------
*** Bug 17754 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benh at bwsint dot com


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


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

* [Bug c++/17585] [3.4/4.0 Regression] g++ generates errors on a legal code.
  2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
                   ` (11 preceding siblings ...)
  2004-09-30 18:02 ` pinskia at gcc dot gnu dot org
@ 2004-09-30 18:13 ` benh at bwsint dot com
  12 siblings, 0 replies; 14+ messages in thread
From: benh at bwsint dot com @ 2004-09-30 18:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From benh at bwsint dot com  2004-09-30 18:13 -------
Please change the summary to be more descriptive. I just waste time reporting
the bug again (as 17754) because I couldn't find this report.

-- 


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


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

end of thread, other threads:[~2004-09-30 18:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 14:48 [Bug c++/17585] New: g++ generates errors on a legal code tal dot agmon at nsc dot com
2004-09-21 14:56 ` [Bug c++/17585] " pinskia at gcc dot gnu dot org
2004-09-21 15:03 ` tal dot agmon at nsc dot com
2004-09-21 18:56 ` bangerth at dealii dot org
2004-09-22  7:22 ` tal dot agmon at nsc dot com
2004-09-22  8:44 ` giovannibajo at libero dot it
2004-09-24 13:08 ` [Bug c++/17585] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-09-24 23:13 ` mmitchel at gcc dot gnu dot org
2004-09-27 14:47 ` cvs-commit at gcc dot gnu dot org
2004-09-27 18:47 ` cvs-commit at gcc dot gnu dot org
2004-09-27 18:50 ` cvs-commit at gcc dot gnu dot org
2004-09-27 21:14 ` mmitchel at gcc dot gnu dot org
2004-09-30 18:02 ` pinskia at gcc dot gnu dot org
2004-09-30 18:13 ` benh at bwsint 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).