public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Class with pointer to function conversion operator
@ 1999-07-03 17:11 John E. Potter
  1999-07-31 23:33 ` Valentin Bonnard
  0 siblings, 1 reply; 2+ messages in thread
From: John E. Potter @ 1999-07-03 17:11 UTC (permalink / raw)
  To: egcs-bugs; +Cc: jpotter

See IS 13.3.1.1.2

This is not in the well known bugs and is an obscure enough and
old enough feature of C++ that I am assuming the bug still
exists.

John

$ g++ bad.egcs.cpp
bad.egcs.cpp: In function `int main()':
bad.egcs.cpp:13: no match for call to `(C) ()'
cc1plus: candidates are:  /* decl error */
$ g++ -v
Reading specs from
/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.0.0/egcs-2.91.55
/specs
gcc version egcs-2.91.55 19980824 (gcc2 ss-980609 experimental)
$ cat bad.egcs.cpp
typedef void (*FP)();
struct C {
        public:
                C(FP ap) : p(ap) { }
                operator FP() { return p; }
        private:
                FP p;
        };
void f () {
        }
int main () {
        C c(f);
        c();
        }



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

* Re: Class with pointer to function conversion operator
  1999-07-03 17:11 Class with pointer to function conversion operator John E. Potter
@ 1999-07-31 23:33 ` Valentin Bonnard
  0 siblings, 0 replies; 2+ messages in thread
From: Valentin Bonnard @ 1999-07-31 23:33 UTC (permalink / raw)
  To: EGCS; +Cc: John E. Potter

Works fine for me:

$ cat > good.egcs.cpp
typedef void (*FP)();
struct C {
        public:
                C(FP ap) : p(ap) { }
                operator FP() { return p; }
        private:
                FP p;
        };
void f () {
        }
int main () {
        C c(f);
        c();
        }

$ eg++ good.egcs.cpp
$ eg++ -v           
Reading specs from
/usr/local/util/packages/egcs-19990620/lib/gcc-lib/sparc-sun-solaris2.5/gcc-2.95/specs
gcc version gcc-2.95 19990620 (prerelease)

-- 

Valentin Bonnard


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

end of thread, other threads:[~1999-07-31 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-03 17:11 Class with pointer to function conversion operator John E. Potter
1999-07-31 23:33 ` Valentin Bonnard

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).