[LLVMbugs] [Bug 13167] New: "Function is not marked const" error message should also be generated for template functions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 21 13:41:32 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13167
Bug #: 13167
Summary: "Function is not marked const" error message should
also be generated for template functions
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: st at quanttec.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The error message that Clang produces for the code
struct Test {
void test1() const { test2(0); }
template <typename T>
void test2(T value) { }
};
int main() {
Test().test1();
}
test.cpp:3:23: error: no matching member function for call to 'test2'
void test1() const { test2(0); }
^~~~~
test.cpp:6:7: note: candidate function [with T = int] not viable: no known
conversion from 'const Test *' to 'Test' for
object argument;
void test2(T value) { }
^
1 error generated.
is less clear than the error it produces for the equivalent non-template code:
struct Test {
void test1() const { test2(0); }
void test2(int value) { }
};
int main() {
Test().test1();
}
test.cpp:3:23: error: member function 'test2' not viable: 'this' argument has
type 'const Test', but function is not
marked const
void test1() const { test2(0); }
^~~~~
test.cpp:5:7: note: 'test2' declared here
void test2(int value) { }
^
1 error generated.
--
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