[LLVMbugs] [Bug 10784] New: accepts invalid templated operator() call

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 26 16:23:17 PDT 2011


           Summary: accepts invalid templated operator() call
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Clang accepts invalid then crashes in codegen on this testcase:

  struct Empty {};
  struct Class {
    const char *method() const;
  struct FunctionLike {
    template<typename T> void operator()(const T&) const {}
  void TestBody() {
    Class cls;
    FunctionLike fl;

I'm not going to paste in the crash itself because it's in codegen and isn't
relevant. Sema should diagnose this. See GCC for example:

001.c: In function ‘void TestBody()’:
001.c:14: error: no match for call to ‘(FunctionLike) (<unresolved overloaded
function type>)’
001.c:8: note: candidates are: void FunctionLike::operator()(const T&) const
[with T = const char* (Class::*)()const]

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.

More information about the llvm-bugs mailing list