public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30281] New: [reject valid?] mismatch type of virtual method.
@ 2006-12-22 21:20 pluto at agmk dot net
2006-12-23 11:21 ` [Bug c++/30281] [reject valid?] type deduction fails pluto at agmk dot net
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pluto at agmk dot net @ 2006-12-22 21:20 UTC (permalink / raw)
To: gcc-bugs
#include <stdexcept>
struct my_error : public std::runtime_error
{
my_error( std::string const& );
};
template < typename T >
struct wrapper
{
template < typename R >
void add_method( R ( T::* )() const );
};
void test()
{
wrapper< my_error >().add_method( &my_error::what );
}
g++ rejects this code:
error: no matching function for call to ‘wrapper<my_error>::add_method(
const char* (std::runtime_error::*)()const)’
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
&my_error::what has &std::runtime_error::what type? weird.
btw.
non-templated add_method( char const* ( my_error::* )() const )
works fine, so i suppose it's a bug in c++ frontend.
--
Summary: [reject valid?] mismatch type of virtual method.
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30281
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30281] [reject valid?] type deduction fails.
2006-12-22 21:20 [Bug c++/30281] New: [reject valid?] mismatch type of virtual method pluto at agmk dot net
@ 2006-12-23 11:21 ` pluto at agmk dot net
2007-01-07 0:56 ` pinskia at gcc dot gnu dot org
2007-01-21 5:23 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: pluto at agmk dot net @ 2006-12-23 11:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pluto at agmk dot net 2006-12-23 11:21 -------
wrapper< my_error >().add_method< char const* >( &my_error::what );
such call compiles, so it looks like type deduction failure.
--
pluto at agmk dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[reject valid?] mismatch |[reject valid?] type
|type of virtual method. |deduction fails.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30281
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30281] [reject valid?] type deduction fails.
2006-12-22 21:20 [Bug c++/30281] New: [reject valid?] mismatch type of virtual method pluto at agmk dot net
2006-12-23 11:21 ` [Bug c++/30281] [reject valid?] type deduction fails pluto at agmk dot net
@ 2007-01-07 0:56 ` pinskia at gcc dot gnu dot org
2007-01-21 5:23 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-07 0:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-01-07 00:54 -------
Reduced testcase:
struct a
{
int g(void);
};
struct b : a { };
template < typename T >
struct wrapper
{
template < typename R >
void add_method( R ( T::* )() const );
};
void test()
{
wrapper< b >().add_method( &b::g );
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30281
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30281] [reject valid?] type deduction fails.
2006-12-22 21:20 [Bug c++/30281] New: [reject valid?] mismatch type of virtual method pluto at agmk dot net
2006-12-23 11:21 ` [Bug c++/30281] [reject valid?] type deduction fails pluto at agmk dot net
2007-01-07 0:56 ` pinskia at gcc dot gnu dot org
@ 2007-01-21 5:23 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2007-01-21 5:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from bangerth at dealii dot org 2007-01-21 05:23 -------
Here's an even simpler testcase that shows the same problem (even if the
error message is different):
-------------
struct a
{
int g(void);
};
struct b : a { };
void test()
{
static_cast<int (b::*)() const> (&b::g);
}
------------------
g/x> c++ -c x.cc
x.cc: In function 'void test()':
x.cc:10: error: invalid static_cast from type 'int (a::*)()' to type 'int
(b::*)()const'
In any case, this is a duplicate of PR 17359.
W.
*** This bug has been marked as a duplicate of 17359 ***
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30281
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-21 5:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-22 21:20 [Bug c++/30281] New: [reject valid?] mismatch type of virtual method pluto at agmk dot net
2006-12-23 11:21 ` [Bug c++/30281] [reject valid?] type deduction fails pluto at agmk dot net
2007-01-07 0:56 ` pinskia at gcc dot gnu dot org
2007-01-21 5:23 ` 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).