summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJacob Bandes-Storch <jacob@bandes-stor.ch>2017-12-31 18:27:29 +0000
committerJacob Bandes-Storch <jacob@bandes-stor.ch>2017-12-31 18:27:29 +0000
commit7a65af2a3afadd2ed099e9fa839ea0ac746933b4 (patch)
tree7d42b4e238627fc67e8dee298b276ce0fdf26169 /include
parent352a8a419d7c9515bd05787c0390238f609cd4ae (diff)
[Sema] Improve diagnostics for const- and ref-qualified member functions
(Re-submission of D39937 with fixed tests.) Adjust wording for const-qualification mismatch to be a little more clear. Also add another diagnostic for a ref qualifier mismatch, which previously produced a useless error (this error path is simply very old; see rL119336): Before: error: cannot initialize object parameter of type 'X0' with an expression of type 'X0' After: error: 'this' argument to member function 'rvalue' is an lvalue, but function has rvalue ref-qualifier Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: lebedev.ri, cfe-commits Differential Revision: https://reviews.llvm.org/D41646 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 01e819942f..e4649d3a44 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1589,12 +1589,20 @@ def err_non_virtual_pure : Error<
def ext_pure_function_definition : ExtWarn<
"function definition with pure-specifier is a Microsoft extension">,
InGroup<MicrosoftPureDefinition>;
-def err_implicit_object_parameter_init : Error<
- "cannot initialize object parameter of type %0 with an expression "
- "of type %1">;
def err_qualified_member_of_unrelated : Error<
"%q0 is not a member of class %1">;
+def err_member_function_call_bad_cvr : Error<
+ "'this' argument to member function %0 has type %1, but function is not marked "
+ "%select{const|restrict|const or restrict|volatile|const or volatile|"
+ "volatile or restrict|const, volatile, or restrict}2">;
+def err_member_function_call_bad_ref : Error<
+ "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
+ "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
+def err_member_function_call_bad_type : Error<
+ "cannot initialize object parameter of type %0 with an expression "
+ "of type %1">;
+
def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
"call to pure virtual member function %0 has undefined behavior; "
"overrides of %0 in subclasses are not available in the "
@@ -1815,10 +1823,6 @@ def warn_temporary_array_to_pointer_decay : Warning<
def err_init_list_bad_dest_type : Error<
"%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
"list">;
-def err_member_function_call_bad_cvr : Error<"member function %0 not viable: "
- "'this' argument has type %1, but function is not marked "
- "%select{const|restrict|const or restrict|volatile|const or volatile|"
- "volatile or restrict|const, volatile, or restrict}2">;
def err_reference_bind_to_bitfield : Error<
"%select{non-const|volatile}0 reference cannot bind to "