From c084bd2888153084cf8bc8c0337a88cf2ab53e8c Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 2 Feb 2013 02:14:45 +0000 Subject: 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 ''". 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 --- clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp') diff --git a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp index 7d1fa7e3ec2..f53ac6dff93 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -125,3 +125,8 @@ namespace multidimensional_array { g({{1,2},{3,4}}); } } + +namespace array_addressof { + using T = int[5]; + T *p = &T{1,2,3,4,5}; // expected-error {{taking the address of a temporary object of type 'T' (aka 'int [5]')}} +} -- cgit v1.2.3