PR15132: Replace "address expression must be an lvalue or a function
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 2 Feb 2013 02:14:45 +0000 (02:14 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 2 Feb 2013 02:14:45 +0000 (02:14 +0000)
commitc084bd2888153084cf8bc8c0337a88cf2ab53e8c
tree7a0da883040e315449c4c1c6c25f5d26b0dc660d
parent4be2c3692112a841f1baf606bf4fcfaff163c2cb
PR15132: Replace "address expression must be an lvalue or a function
designator" diagnostic with more correct and more human-friendly "cannot take
address of rvalue of type 'T'".

For the case of & &T::f, provide a custom diagnostic, rather than unhelpfully
saying "cannot take address of rvalue of type '<overloaded function type>'".

For the case of &array_temporary, treat it just like a class temporary
(including allowing it as an extension); the existing diagnostic wording
for the class temporary case works fine.

llvm-svn: 174262
12 files changed:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGenCXX/cxx0x-initializer-array.cpp
clang/test/Parser/objcxx0x-lambda-expressions.mm
clang/test/Sema/complex-imag.c
clang/test/Sema/expr-address-of.c
clang/test/Sema/varargs.c
clang/test/SemaCXX/address-of.cpp
clang/test/SemaCXX/conditional-expr.cpp
clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp
clang/test/SemaCXX/nullptr.cpp
clang/test/SemaTemplate/temp_arg_nontype.cpp