public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26799]  New: Type deduction of a pointer-to-member
@ 2006-03-22 11:20 wolfgang dot roehrl at gi-de dot com
  2006-03-22 15:35 ` [Bug c++/26799] " pinskia at gcc dot gnu dot org
  2006-03-22 15:36 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: wolfgang dot roehrl at gi-de dot com @ 2006-03-22 11:20 UTC (permalink / raw)
  To: gcc-bugs

Dear all,

I would like to post a bug report for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPC processor.

Used invokation line for the GNU C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
      -fmerge-templates -mmultiple -mno-string -mstrict-align -O3
      -fno-exceptions -fno-rtti -fno-builtin-printf
      -I<some include paths>
      -D<some #define's>
      X.CPP -oX.O


// file X.CPP

void g (void*);

struct ABC
{
    template <typename T_, typename U_>
    ABC (void (T_::* ptrFunc)(), U_& refObj)
    {
        T_* pObj = &refObj;
        g (pObj);                   // <--- line 9
    }
};

struct DEF
{
    void f () const;
};

DEF def;
ABC abc(&DEF::f, def);


The compiler gives the following error message:

X.CPP: In constructor `ABC::ABC(void (T_::*)(), U_&) [with T_ = const DEF, 
       U_ = DEF]':
X.CPP:19:   instantiated from here
X.CPP:9: error: invalid conversion from `const void*' to `void*'


The compilation of the code above fails but for a wrong reason: it should fail
because the pointer to function f has type 'void (DEF::*)() const' and there
is no constructor available whose first parameter fits the mentioned type.

But the GNU compiler erronously deduces the type 'void (const DEF::*)()' for
the first constructor parameter as the error message shows.


Kind regards
W. Roehrl


-- 
           Summary: Type deduction of a pointer-to-member
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wolfgang dot roehrl at gi-de dot com
 GCC build triplet: sparc-sun-solaris2.5.1
  GCC host triplet: i386-pc-mingw32
GCC target triplet: powerpc-wrs-vxworks


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


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

* [Bug c++/26799] Type deduction of a pointer-to-member
  2006-03-22 11:20 [Bug c++/26799] New: Type deduction of a pointer-to-member wolfgang dot roehrl at gi-de dot com
@ 2006-03-22 15:35 ` pinskia at gcc dot gnu dot org
  2006-03-22 15:36 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-22 15:35 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-22 15:35 -------
I get a different error message on the mainline:
t7.cc:19: error: no matching function for call to ‘ABC::ABC(void
(DEF::*)()const, DEF&)’
t7.cc:4: note: candidates are: ABC::ABC(const ABC&)


-- 


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


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

* [Bug c++/26799] Type deduction of a pointer-to-member
  2006-03-22 11:20 [Bug c++/26799] New: Type deduction of a pointer-to-member wolfgang dot roehrl at gi-de dot com
  2006-03-22 15:35 ` [Bug c++/26799] " pinskia at gcc dot gnu dot org
@ 2006-03-22 15:36 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-22 15:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-22 15:36 -------
Fixed in 4.0.0, the error message is the same as in comment #1.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2006-03-22 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-22 11:20 [Bug c++/26799] New: Type deduction of a pointer-to-member wolfgang dot roehrl at gi-de dot com
2006-03-22 15:35 ` [Bug c++/26799] " pinskia at gcc dot gnu dot org
2006-03-22 15:36 ` 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).