From: Max Lawson <mlawson@drfmc.ceng.cea.fr>
To: egcs-bugs@cygnus.com
Cc: egcs@cygnus.com
Subject: yet another template instantiation problem (w/ short snapshot :)
Date: Thu, 30 Oct 1997 09:05:00 -0000 [thread overview]
Message-ID: <9710301653.AA13589@drfmc.ceng.cea.fr> (raw)
Hi !
The following program doesn't compile with egcs-971023 on a
i586-pc-linux-glibc1 box (libc5.4.39; boot_cflags="-g -O2")
Here's the source file:
----------------z.cc-----------------------------------------------
#include <iostream.h>
template<class O, class T>
class mu_mem_fun_mvars
{
private:
O *obj_;
T (O::*m_func_)(const T&);
public:
// constructor
explicit mu_mem_fun_mvars(O& obj, T (O::*m_func)(const T&))
: obj_(&obj), m_func_(m_func)
{ }
// evaluation of the integrand at the "current" point v
T operator() ( const T& v ) { return (obj_->*m_func)(v); }
};
struct foo
{
double f(const double& t) { return 2*t; }
};
foo ff;
template<class F, class T>
T bar( F& z) { return z(1.0); }
int main()
{
cout << bar(mu_mem_fun_mvars(ff,&foo::f)) << endl;
return 0;
}
--------------------------------------------------
and the compilation results:
g++ -Wall -g -O6 z.cc
z.cc: In function `int main()':
z.cc:38: warning: implicit declaration of function `int mu_mem_fun_mvars(...)'
z.cc:38: warning: cannot pass objects of type `double (foo::*)(const double &)' through `...'
z.cc:38: incomplete type unification
z.cc:38: no matching function for call to `bar (int)'
=> Could sbdy explain me why the call to the class "mu_mem_fun_mvars"
constructor isn't handled the right way ?
This behaviour, IMHO, in a larger source make cc1plus have a fatal signal 11 :(
Thanx in advance, Max
next reply other threads:[~1997-10-30 9:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-30 9:05 Max Lawson [this message]
1997-10-30 13:13 ` Alexandre Oliva
1997-10-31 0:59 Max Lawson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9710301653.AA13589@drfmc.ceng.cea.fr \
--to=mlawson@drfmc.ceng.cea.fr \
--cc=egcs-bugs@cygnus.com \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).