public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19894] New: pointer-to-void member not rejected in template
@ 2005-02-11 12:10 reichelt at gcc dot gnu dot org
  2005-02-11 13:30 ` [Bug c++/19894] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-11 12:10 UTC (permalink / raw)
  To: gcc-bugs

The following invalid testcase is accepted since at least gcc 2.95.3
(pointer to void member should be rejected):

==================================
template<typename T> struct A
{
    T A::* p;
};

A<void> a;
==================================

-- 
           Summary: pointer-to-void member not rejected in template
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
@ 2005-02-11 13:30 ` pinskia at gcc dot gnu dot org
  2005-02-11 22:49 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-11 13:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-11 02:59 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-11 02:59:27
               date|                            |


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
  2005-02-11 13:30 ` [Bug c++/19894] " pinskia at gcc dot gnu dot org
@ 2005-02-11 22:49 ` bangerth at dealii dot org
  2005-02-14 19:47 ` reichelt at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2005-02-11 22:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-02-11 17:44 -------
Quite naively, I would say that this could even be ok, just that there will 
never be a member variable the address of which one could initialize this 
pointer-to-member with. Do you have chapter and verse where this is 
prohibited? 
 
W. 

-- 


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
  2005-02-11 13:30 ` [Bug c++/19894] " pinskia at gcc dot gnu dot org
  2005-02-11 22:49 ` bangerth at dealii dot org
@ 2005-02-14 19:47 ` reichelt at gcc dot gnu dot org
  2005-05-16  3:06 ` donaldc at csgsolar dot com dot au
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-14 19:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-14 15:05 -------
> Quite naively, I would say that this could even be ok, just that there will 
> never be a member variable the address of which one could initialize this 
> pointer-to-member with. Do you have chapter and verse where this is 
> prohibited? 
>  
> W. 

The third paragraph of [8.3.3] aka [dcl.mptr] says:

A pointer to member shall not point to a static member of a class (9.4),
a member with reference type, or "cv void."


-- 


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-02-14 19:47 ` reichelt at gcc dot gnu dot org
@ 2005-05-16  3:06 ` donaldc at csgsolar dot com dot au
  2005-06-07 19:40 ` reichelt at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: donaldc at csgsolar dot com dot au @ 2005-05-16  3:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From donaldc at csgsolar dot com dot au  2005-05-16 03:06 -------
> The third paragraph of [8.3.3] aka [dcl.mptr] says:
> 
> A pointer to member shall not point to a static member of a class (9.4),
> a member with reference type, or "cv void."

It can be equal to null, though. The following should all compile:
 
a=0;
if (a==0) { } // always true
if (a!=0) {}  // always false

I don't think there's a bug.


-- 


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-05-16  3:06 ` donaldc at csgsolar dot com dot au
@ 2005-06-07 19:40 ` reichelt at gcc dot gnu dot org
  2005-06-08 11:09 ` cvs-commit at gcc dot gnu dot org
  2005-06-08 11:12 ` reichelt at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-06-07 19:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-06-07 19:39 -------
No, it's really a bug.

In 3.9.2 [basic.compound] we have:

  Compound types can be constructed in the following ways:
  [...]
  - pointers to void or objects or functions (...) of a given type,
  [...]
  - pointers to non-static class members, which identify members of a given
    type within objects of a given class.

This also shows that no pointers to members of type void are allowed:
a) There is no such thing as a void data member in a class.
b) For regular pointers "void" is added explicitly, but not for
   pointers to members.

BTW, the compiler rejects them in the non-template case.
This is only an omission in the template case.

I'm testing a patch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |reichelt at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-06-07 19:40 ` reichelt at gcc dot gnu dot org
@ 2005-06-08 11:09 ` cvs-commit at gcc dot gnu dot org
  2005-06-08 11:12 ` reichelt at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-08 11:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-08 11:09 -------
Subject: Bug 19894

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2005-06-08 11:09:13

Modified files:
	gcc/cp         : ChangeLog parser.c pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: label4.C 
	gcc/testsuite/g++.dg/template: ptrmem15.C 

Log message:
	PR c++/19894
	* pt.c (tsubst): Reject pointer-to-member of type void.
	
	* g++.dg/template/ptrmem15.C: New test.
	
	PR c++/20563
	* parser.c (cp_parser_label_declaration): Deal with invalid/missing
	identifiers.
	
	* g++.dg/ext/label4.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4781&r2=1.4782
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.339&r2=1.340
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1003&r2=1.1004
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5612&r2=1.5613
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/label4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ptrmem15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/19894] pointer-to-void member not rejected in template
  2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-06-08 11:09 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-08 11:12 ` reichelt at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-06-08 11:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-06-08 11:12 -------
Fixed in mainline (will become GCC 4.1.0).


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

end of thread, other threads:[~2005-06-08 11:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-11 12:10 [Bug c++/19894] New: pointer-to-void member not rejected in template reichelt at gcc dot gnu dot org
2005-02-11 13:30 ` [Bug c++/19894] " pinskia at gcc dot gnu dot org
2005-02-11 22:49 ` bangerth at dealii dot org
2005-02-14 19:47 ` reichelt at gcc dot gnu dot org
2005-05-16  3:06 ` donaldc at csgsolar dot com dot au
2005-06-07 19:40 ` reichelt at gcc dot gnu dot org
2005-06-08 11:09 ` cvs-commit at gcc dot gnu dot org
2005-06-08 11:12 ` reichelt 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).