[LLVMbugs] [Bug 12096] New: Incorrectly binding extra arguments when variadic template argument is not the last one.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Feb 27 06:40:00 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12096
Bug #: 12096
Summary: Incorrectly binding extra arguments when variadic
template argument is not the last one.
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: sbenza at google.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
void Foo(int){}
void Foo(int,int){}
template <typename... Args>
struct Var {
Var(const Args&... args, int*) { Foo(args...); }
};
int main(int argc, char** argv) {
Var<int> var(1, 0);
return 0;
}
============================
The call to Foo(args...) is binding the int* argument too and it is trying to
call Foo(int, int*) as shown on the error messages.
5:36: error: no matching function for call to 'Foo'
Var(const Args&... args, int*) { Foo(args...); }
^~~
9:12: note: in instantiation of member function 'Var<int>::Var' requested here
Var<int> var(1, 0);
^
2:6: note: candidate function not viable: no known conversion from 'int *' to
'int' for
2nd argument; dereference the argument with *
void Foo(int,int){}
^
1:6: note: candidate function not viable: requires 1 argument, but 2 were
provided
void Foo(int){}
In debug mode, clang asserts with:
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:2469: void
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool): Assertion `FParamIdx <
Function->getNumParams()' failed.
--
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