[LLVMbugs] [Bug 14995] New: Too eagerly rejects operator function templates

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 18 14:37:05 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=14995

             Bug #: 14995
           Summary: Too eagerly rejects operator function templates
           Product: clang
           Version: 3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub.johannes at googlemail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Clang rejects this code:

#include <iostream>
#include <utility>

struct B { 
  // ...
};

template<typename ...T>
void operator++(B, T...) {
  std::cout << ((sizeof...(T) == 0) ? "prefix" : "postfix") << std::endl;
}

int main() {
  B b;
  b++;
  ++b;
}

Saying

main.cpp:9:24: error: parameter of overloaded post-increment operator must have
type 'int' (not 'T...')

However a valid specialization (operator function), where the parameter type is
"int", can be generated for the template. So it appears to be wrong to me that
clang rejects it. 

GCC accepts.

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