Author: ericwf Date: Wed Jul 25 04:16:39 2018 New Revision: 337905 URL: http://llvm.org/viewvc/llvm-project?rev=337905&view=rev Log: Fix diagnostic test to tolerate Clang diagnosing it as well.
Tuple has tests that ensure we diagnose non-lifetime extended reference bindings inside tuples constructors. As of yesterday, Clang now does this for us. Adjust the test to tolerate the new diagnostics, while still testing that we emit diagnostics of our own. Maybe after this version of Clang has been adopted by most users we should remove our diagnostics; but for now more error detection is better! Modified: libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp Modified: libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp?rev=337905&r1=337904&r2=337905&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp Wed Jul 25 04:16:39 2018 @@ -46,7 +46,12 @@ void F(typename CannotDeduce<std::tuple< int main() { #if TEST_HAS_BUILTIN_IDENTIFIER(__reference_binds_to_temporary) + // Test that we emit our diagnostic from the library. // expected-error@tuple:* 8 {{"Attempted construction of reference element binds to a temporary whose lifetime has ended"}} + + // Good news everybody! Clang now diagnoses this for us! + // expected-error@tuple:* 0+ {{reference member '__value_' binds to a temporary object whose lifetime would be shorter than the lifetime of the constructed object}} + { F<int, const std::string&>(std::make_tuple(1, "abc")); // expected-note 1 {{requested here}} } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits