Hello.
When parsing the following program:
Hello.
When parsing the following program:
Hello.
[...]
It's not a bug. You can't do that.
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#61
Many thanks for the prompt answer and the pointer.
I thought this restriction was for instance methods only ...
Enea.
Hello Richard,
I am afraid there is still something unclear to me
(I may be missing something obvious ...):
Hello.
When parsing the following program:
==============================__=====
$ cat addrof-overloaded.cc
struct S {
static void foo(int);
static void foo(double);
} s;typedef void (*PF)(int);
void test() {
PF pf1 = s.foo; // No error.
PF pf2 = &s.foo; // Error(?)
}
==============================__=====the following parse error is obtained:
==============================__=====
$ clang++ -fsyntax-only addrof-overloaded.cc
addrof-overloaded.cc:10:12: error: cannot create a non-constant
pointer to
member function
PF pf2 = &s.foo; // Error(?)
^~~~~~
1 error generated.
==============================__=====Is this a known bug?
It's not a bug. You can't do that.
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#61
Why isn't clang issuing a similar diagnostics for the first line:
> PF pf1 = s.foo; // No error.
Reading 13.4 in the C++03 standard, there seems to be no distinction of whether or not the address-of operator is explicitly used (it is meant, for non-instance methods):
Hmm, I missed that part of your question. I think that is a bug; we should reject both examples.