diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-06-27 08:02:19 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-06-27 08:02:19 +0000 |
commit | c93322182615e2333e85ff21d8a93b2e4fce1e3d (patch) | |
tree | 3628201f819d00bbce177993fb02fcc1b6f207ed /clang/test/SemaCXX/null_in_arithmetic_ops.cpp | |
parent | a61df3f843f3ec49fb6952a5a4cf94c0938307a4 (diff) | |
download | bcm5719-llvm-c93322182615e2333e85ff21d8a93b2e4fce1e3d.tar.gz bcm5719-llvm-c93322182615e2333e85ff21d8a93b2e4fce1e3d.zip |
Factor out (some of) the checking for invalid forms of pointer
arithmetic into a couple of common routines. Use these to make the
messages more consistent in the various contexts, especially in terms of
consistently diagnosing binary operators with invalid types on both the
left- and right-hand side. Also, improve the grammar and wording of the
messages some, handling both two pointers and two (different) types.
The wording of function pointer arithmetic diagnostics still strikes me
as poorly phrased, and I worry this makes them slightly more awkward if
more consistent. I'm hoping to fix that with a follow-on patch and test
case that will also make them more helpful when a typedef or template
type parameter makes the type completely opaque.
Suggestions on better wording are very welcome, thanks to Richard Smith
for some initial help on that front.
llvm-svn: 133906
Diffstat (limited to 'clang/test/SemaCXX/null_in_arithmetic_ops.cpp')
-rw-r--r-- | clang/test/SemaCXX/null_in_arithmetic_ops.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/null_in_arithmetic_ops.cpp b/clang/test/SemaCXX/null_in_arithmetic_ops.cpp index 26af5e6e75c..fab6f10ab78 100644 --- a/clang/test/SemaCXX/null_in_arithmetic_ops.cpp +++ b/clang/test/SemaCXX/null_in_arithmetic_ops.cpp @@ -33,7 +33,7 @@ void f() { v = 0 ? NULL + d : d + NULL; // \ expected-error {{invalid operands to binary expression ('long' and 'void (X::*)()')}} \ expected-error {{invalid operands to binary expression ('void (X::*)()' and 'long')}} - v = 0 ? NULL + e : e + NULL; // expected-error 2{{arithmetic on pointer to function type 'void (*)()'}} + v = 0 ? NULL + e : e + NULL; // expected-error 2{{arithmetic on a pointer to the function type 'void ()'}} v = 0 ? NULL + f : f + NULL; // expected-warning 2{{use of NULL in arithmetic operation}} v = 0 ? NULL + "f" : "f" + NULL; // expected-warning 2{{use of NULL in arithmetic operation}} |