public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21853] New: constness of pointer to data member ignored
@ 2005-06-01  0:05 david dot m dot krauss at intel dot com
  2005-06-01  0:11 ` [Bug c++/21853] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: david dot m dot krauss at intel dot com @ 2005-06-01  0:05 UTC (permalink / raw)
  To: gcc-bugs

When casting a pointer to const to a pointer to const pointer to data member
type, the constness of the ptdm is ignored. This breaks ptdm members of
boost::variant union types. Example code:

struct blah {
	int a;
};

int main( int argc, char ** argv ) {
	int blah::* ptdma = &blah::a;

	const void *ptdmv = static_cast< void * >( &ptdma );

	int blah::* const ptdmb = * static_cast< int blah::* const * >( ptdmv );

	return 0;
}

This code compiles fine on the Comeau web test-drive. GCC 3.1, 3.4.3, and 4.0.0
all choke on the second static_cast. (I'm only filing for 4.0.0.)

More stats:

% /usr/intel/pkgs/gcc/4.0.0/bin/g++ -v -save-temps test2.cpp
Reading specs from
/nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.0/configure --prefix=/usr/intel/pkgs/gcc/4.0.0
--with-as=/usr/intel/pkgs/gcc/4.0.0/bin/gas
--with-ld=/usr/intel/pkgs/gcc/4.0.0/bin/gld --disable-libgcj
--enable-languages=c,c++,objc
Thread model: posix
gcc version 4.0.0
 /nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../libexec/gcc/i686-pc-linux-gnu/4.0.0/cc1plus
-E -quiet -v -iprefix
/nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/
-D_GNU_SOURCE test2.cpp -mtune=pentiumpro -fpch-preprocess -o test2.ii
ignoring nonexistent directory
"/nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory
"/usr/intel/pkgs/gcc/4.0.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0"
ignoring duplicate directory
"/usr/intel/pkgs/gcc/4.0.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/i686-pc-linux-gnu"
ignoring duplicate directory
"/usr/intel/pkgs/gcc/4.0.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/backward"
ignoring duplicate directory
"/usr/intel/pkgs/gcc/4.0.0/lib/gcc/i686-pc-linux-gnu/4.0.0/include"
ignoring nonexistent directory
"/usr/intel/pkgs/gcc/4.0.0/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0
 /nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/i686-pc-linux-gnu
 /nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/backward
 /nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../lib/gcc/i686-pc-linux-gnu/4.0.0/include
 /usr/local/include
 /usr/intel/pkgs/gcc/4.0.0/include
 /usr/include
End of search list.
 /nfs/site/itools/i386_linux24/pkgs/gcc/4.0.0/bin/../libexec/gcc/i686-pc-linux-gnu/4.0.0/cc1plus
-fpreprocessed test2.ii -quiet -dumpbase test2.cpp -mtune=pentiumpro -auxbase
test2 -version -o test2.s
GNU C++ version 4.0.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.2.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128505
test2.cpp: In function 'int main(int, char**)':
test2.cpp:10: error: static_cast from type 'const void*' to type 'const int
blah::* const* const' casts away constness

-- 
           Summary: constness of pointer to data member ignored
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: david dot m dot krauss at intel dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
  2005-06-01  0:11 ` [Bug c++/21853] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-06-01  0:11 ` pinskia at gcc dot gnu dot org
  2005-06-01  0:12 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01  0:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-01 00:11:22
               date|                            |


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
@ 2005-06-01  0:11 ` pinskia at gcc dot gnu dot org
  2005-06-01  0:11 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01  0:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-01 00:11 -------
Confirmed, a regression from 2.95.3 where we accepted the code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
      Known to fail|                            |3.3.3 3.4.0 4.0.0 4.1.0
                   |                            |3.0.4 3.2.3
      Known to work|                            |2.95.3
            Summary|constness of pointer to data|[3.4/4.0/4.1 Regression]
                   |member ignored              |constness of pointer to data
                   |                            |member ignored
   Target Milestone|---                         |3.4.5


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
  2005-06-01  0:11 ` [Bug c++/21853] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-06-01  0:11 ` pinskia at gcc dot gnu dot org
@ 2005-06-01  0:12 ` pinskia at gcc dot gnu dot org
  2005-06-01  1:44 ` david dot m dot krauss at intel dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01  0:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-01 00:12 -------
This has been failing since at least 2000-12-31.

-- 


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
                   ` (2 preceding siblings ...)
  2005-06-01  0:12 ` pinskia at gcc dot gnu dot org
@ 2005-06-01  1:44 ` david dot m dot krauss at intel dot com
  2005-06-03 16:42 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: david dot m dot krauss at intel dot com @ 2005-06-01  1:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From david dot m dot krauss at intel dot com  2005-06-01 01:44 -------
Subject: RE:  [3.4/4.0/4.1 Regression] constness of pointer to data member ignored

Yo Andrew!!!!

How's it hangin'?

Sorry to say, my address means what it looks like...

	- David


-----Original Message-----
From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org] 
Sent: Tuesday, May 31, 2005 5:12 PM
To: Krauss, David M
Subject: [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer
to data member ignored


------- Additional Comments From pinskia at gcc dot gnu dot org
2005-06-01 00:12 -------
This has been failing since at least 2000-12-31.



-- 


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
                   ` (3 preceding siblings ...)
  2005-06-01  1:44 ` david dot m dot krauss at intel dot com
@ 2005-06-03 16:42 ` mmitchel at gcc dot gnu dot org
  2005-06-03 23:22 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-06-03 16:42 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
                   ` (4 preceding siblings ...)
  2005-06-03 16:42 ` mmitchel at gcc dot gnu dot org
@ 2005-06-03 23:22 ` cvs-commit at gcc dot gnu dot org
  2005-06-03 23:24 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-03 23:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-03 23:22 -------
Subject: Bug 21853

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-06-03 23:22:11

Modified files:
	gcc/cp         : ChangeLog typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/expr: static_cast6.C 

Log message:
	PR c++/21853
	* typeck.c (casts_away_constness_r): Do not drop cv-qualifiers on
	the pointed-to type for a pointer-to-member.
	
	PR c++/21853
	* g++.dg/expr/static_cast6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4773&r2=1.4774
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.632&r2=1.633
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5587&r2=1.5588
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/static_cast6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
                   ` (5 preceding siblings ...)
  2005-06-03 23:22 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-03 23:24 ` cvs-commit at gcc dot gnu dot org
  2005-06-03 23:25 ` mmitchel at gcc dot gnu dot org
  2005-06-03 23:25 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-03 23:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-03 23:24 -------
Subject: Bug 21853

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	mmitchel@gcc.gnu.org	2005-06-03 23:23:41

Modified files:
	gcc/cp         : ChangeLog typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/expr: static_cast6.C 

Log message:
	PR c++/21853
	* typeck.c (casts_away_constness_r): Do not drop cv-qualifiers on
	the pointed-to type for a pointer-to-member.
	
	PR c++/21853
	* g++.dg/expr/static_cast6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.56&r2=1.4648.2.57
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.616.2.8&r2=1.616.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.222&r2=1.5084.2.223
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/static_cast6.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
                   ` (7 preceding siblings ...)
  2005-06-03 23:25 ` mmitchel at gcc dot gnu dot org
@ 2005-06-03 23:25 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-03 23:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-03 23:25 -------
Subject: Bug 21853

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2005-06-03 23:24:54

Modified files:
	gcc/cp         : ChangeLog typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/expr: static_cast6.C 

Log message:
	PR c++/21853
	* typeck.c (casts_away_constness_r): Do not drop cv-qualifiers on
	the pointed-to type for a pointer-to-member.
	
	PR c++/21853
	* g++.dg/expr/static_cast6.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.221&r2=1.3892.2.222
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.27&r2=1.519.2.28
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.400&r2=1.3389.2.401
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/static_cast6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1



-- 


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


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

* [Bug c++/21853] [3.4/4.0/4.1 Regression] constness of pointer to data member ignored
  2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
                   ` (6 preceding siblings ...)
  2005-06-03 23:24 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-03 23:25 ` mmitchel at gcc dot gnu dot org
  2005-06-03 23:25 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-06-03 23:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-06-03 23:25 -------
Fixed in 3.4.5.

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


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


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

end of thread, other threads:[~2005-06-03 23:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-01  0:05 [Bug c++/21853] New: constness of pointer to data member ignored david dot m dot krauss at intel dot com
2005-06-01  0:11 ` [Bug c++/21853] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-06-01  0:11 ` pinskia at gcc dot gnu dot org
2005-06-01  0:12 ` pinskia at gcc dot gnu dot org
2005-06-01  1:44 ` david dot m dot krauss at intel dot com
2005-06-03 16:42 ` mmitchel at gcc dot gnu dot org
2005-06-03 23:22 ` cvs-commit at gcc dot gnu dot org
2005-06-03 23:24 ` cvs-commit at gcc dot gnu dot org
2005-06-03 23:25 ` mmitchel at gcc dot gnu dot org
2005-06-03 23:25 ` 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).