[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [LLVMbugs] [Bug 13235] New: terrible diagnostic text taking address of bound member function
From: bugzilla-daemon () llvm ! org
Date: 2012-06-29 2:36:24
Message-ID: bug-13235-206 () http ! llvm ! org/bugs/
[Download RAW message or body]
http://llvm.org/bugs/show_bug.cgi?id=13235
Bug #: 13235
Summary: terrible diagnostic text taking address of bound
member function
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs@nondot.org
ReportedBy: nlewycky@google.com
CC: dgregor@apple.com, llvmbugs@cs.uiuc.edu
Classification: Unclassified
This snippet comes from test/SemaCXX/member-pointer.cpp, so we really have no
excuse:
namespace pr5985 {
struct c {
void h();
void f() {
void (c::*p)();
p = &h; // expected-error {{must explicitly qualify}}
p = &this->h; // expected-error {{cannot create a non-constant pointer to
member function}}
p = &(*this).h; // expected-error {{cannot create a non-constant pointer
to member function}}
}
};
}
What is this "non-constant" nonsense? The error is that we're trying to create
a pointer to a bound member function. Look at what GCC says on the same
snippet:
z.cc: In member function ‘void pr5985::c::f()':
z.cc:6: error: ISO C++ forbids taking the address of an unqualified or
parenthesized non-static member function to form a pointer to member function.
Say ‘&pr5985::c::h'
z.cc:7: error: ISO C++ forbids taking the address of a bound member function to
form a pointer to member function. Say ‘&pr5985::c::h'
z.cc:8: error: ISO C++ forbids taking the address of an unqualified or
parenthesized non-static member function to form a pointer to member function.
Say ‘&pr5985::c::h'
That's better. GCC even includes a "fixit".
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic