public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22059] New: Inherited member as template argument
@ 2005-06-14  9:15 karlu at itn dot liu dot se
  2005-06-14  9:17 ` [Bug c++/22059] " karlu at itn dot liu dot se
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: karlu at itn dot liu dot se @ 2005-06-14  9:15 UTC (permalink / raw)
  To: gcc-bugs

user@host> gcc -Wall -o bug bug.cpp
bug.cpp: In function `int main()':
bug.cpp:23: error: could not convert template argument `&A::a' to `int AA::*'
bug.cpp:23: error: invalid type in declaration before ';' token
bug.cpp:17: warning: unused variable 'c'
bug.cpp:19: warning: unused variable 'cc'
bug.cpp:21: warning: unused variable 'b1'
bug.cpp:23: warning: unused variable 'b2'

user@host> uname -a
Linux red 2.6.11 #1 Thu Mar 3 15:09:43 CET 2005 i686 GNU/Linux

user@host> cat /etc/debian_version
testing/unstable

user@host> gcc -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.5/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.5 20050605 (prerelease) (Debian 3.4.4-0)

Tested also on "gcc (GCC) 3.3.6 (Debian 1:3.3.6-6)"

-- 
           Summary: Inherited member as template argument
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: karlu at itn dot liu dot se
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/22059] Inherited member as template argument
  2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
@ 2005-06-14  9:17 ` karlu at itn dot liu dot se
  2005-06-14  9:18 ` karlu at itn dot liu dot se
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: karlu at itn dot liu dot se @ 2005-06-14  9:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From karlu at itn dot liu dot se  2005-06-14 09:17 -------
Created an attachment (id=9084)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9084&action=view)
Test case

Compile and you will get an error.

-- 


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


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

* [Bug c++/22059] Inherited member as template argument
  2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
  2005-06-14  9:17 ` [Bug c++/22059] " karlu at itn dot liu dot se
@ 2005-06-14  9:18 ` karlu at itn dot liu dot se
  2005-06-14  9:26 ` karlu at itn dot liu dot se
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: karlu at itn dot liu dot se @ 2005-06-14  9:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From karlu at itn dot liu dot se  2005-06-14 09:18 -------
Created an attachment (id=9085)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9085&action=view)
The preprocessed file

This file contains pretty much the same thing as the test case.

-- 


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


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

* [Bug c++/22059] Inherited member as template argument
  2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
  2005-06-14  9:17 ` [Bug c++/22059] " karlu at itn dot liu dot se
  2005-06-14  9:18 ` karlu at itn dot liu dot se
@ 2005-06-14  9:26 ` karlu at itn dot liu dot se
  2005-06-14 12:38 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: karlu at itn dot liu dot se @ 2005-06-14  9:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From karlu at itn dot liu dot se  2005-06-14 09:25 -------
I forgot to describe the problem.

The attached source code contains a template that has a member pointer argument.
 When the template is used in a way so that the pointer should refer to an
inherited member a compiler error is rendered.  I have also included a member
pointer example that is not in a template and that works fine.  I'm not good at
reading the standard, but from what I can see there should be no difference
between how a member pointers are handled in template arguments and elsewhere.

-- 


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


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

* [Bug c++/22059] Inherited member as template argument
  2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
                   ` (2 preceding siblings ...)
  2005-06-14  9:26 ` karlu at itn dot liu dot se
@ 2005-06-14 12:38 ` pinskia at gcc dot gnu dot org
  2005-06-14 12:45 ` pinskia at gcc dot gnu dot org
  2005-07-23 21:10 ` bangerth at dealii dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 12:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #9084|text/html                   |text/plain
          mime type|                            |


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


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

* [Bug c++/22059] Inherited member as template argument
  2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
                   ` (3 preceding siblings ...)
  2005-06-14 12:38 ` pinskia at gcc dot gnu dot org
@ 2005-06-14 12:45 ` pinskia at gcc dot gnu dot org
  2005-07-23 21:10 ` bangerth at dealii dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-14 12:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-14 12:45 -------
14.3.2 (5) says the following:
For a non-type template-parameter of type pointer to data member, qualification conversions (4.4) are 
applied.


Meaning only adding cvq can be added which makes this invalid code.

ICC also rejects this code for the same reason as GCC.

-- 


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


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

* [Bug c++/22059] Inherited member as template argument
  2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
                   ` (4 preceding siblings ...)
  2005-06-14 12:45 ` pinskia at gcc dot gnu dot org
@ 2005-07-23 21:10 ` bangerth at dealii dot org
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2005-07-23 21:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-07-23 21:07 -------
Just as Andrew says -- you can't do this. No conversions are applied. 
W.  

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


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


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

end of thread, other threads:[~2005-07-23 21:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14  9:15 [Bug c++/22059] New: Inherited member as template argument karlu at itn dot liu dot se
2005-06-14  9:17 ` [Bug c++/22059] " karlu at itn dot liu dot se
2005-06-14  9:18 ` karlu at itn dot liu dot se
2005-06-14  9:26 ` karlu at itn dot liu dot se
2005-06-14 12:38 ` pinskia at gcc dot gnu dot org
2005-06-14 12:45 ` pinskia at gcc dot gnu dot org
2005-07-23 21:10 ` bangerth at dealii 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).