[Bug 20606] New: std::string vs. string literal comparison through "expr" command fails

Bug ID 20606
Summary std::string vs. string literal comparison through “expr” command fails
Product lldb
Version unspecified
Hardware HP
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter rdsmith@chromium.org
Classification Unclassified

Created attachment 12872 [details]
Source file for reproduction

If you try and execute C++ code comparing a std::string with a string literal
using "expr", you get a warning and and error:

(lldb) expr abc == "abc"
error: warning: result of comparison against a string literal is unspecified
(use strncmp instead)
error: invalid operands to binary expression ('string' (aka
'std::basic_string<char, std::char_traits<char>, std::allocator<char> >') and
'const char *')
error: 1 errors parsing expression
(lldb) 

That comparison works fine when compiled by clang++, despite the fact that the
first warning comes from the clang library
(tools/clang/lib/Sema/SemaExpr.cpp:7960 at r215285).  I poked around in that
function, and it seems like it's designed to warn against string literal
comparison in the large majority of cases (including this one).  So the
confusing thing here may be that clang++ doesn't warn about the comparison when
compiling (though I think that is the proper behavior, since std::string
explicitly defines a binary comparison operator of std::string vs. char*).

I did not explore the function where the second error comes from
(tools/clang/lib/Sema/SemaExpr.cpp:6798, same revision).

Reproduction: Compile the attached file with clang++ -g test2.cc (note the lack
of error or warning), and 

lldb a.out
break set -f test2.cc -l 8
run
expr abc == "abc"