<div dir="ltr">My dream, and something I would like to work towards is supporting something like this:<div><br></div><div>> [[clang::libcxx_diagnose_if(cond, "message", "warning", /* warning-id*/ "non-const-functor")]]<br><div>></div><div>> -Wno-libcxx-warnings=non-const-functor</div></div><div><br></div><div>This way libc++ warnings get treated differently from all other users of diagnose_if, and can be enabled</div><div>and disabled separately.</div><div><br></div><div>@George does this sound like a reasonable goal? If so I'm happy to start working on this.</div><div><br></div><div>/Eric</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 23, 2017 at 11:46 AM, George Burgess <span dir="ltr"><<a href="mailto:gbiv@google.com" target="_blank">gbiv@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The only plan that we have at the moment is basically for a -Wno-user-defined-warnings-in-<wbr>system-headers type of flag. I agree that it would be nice if we could be more granular than this, so I'll think about what we can do.<div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 23, 2017 at 8:36 AM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This happens to fire in practice in protobuf. It's probably a true positive and it's cool that this warning found it, but it means we have to disable Wuser-defined-warnings for a bit -- which then disables all of these user-defined warnings. Right now there aren't any others, but it feels like we'd want to have the ability to turn individual user-defined warnings on or off instead of just having a single toggle for all of them. Are there plans for something like that?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 13, 2017 at 5:02 PM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Fri Jan 13 16:02:08 2017<br>
New Revision: 291961<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=291961&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=291961&view=rev</a><br>
Log:<br>
Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros.<br>
<br>
Clang recently added a `diagnose_if(cond, msg, type)` attribute<br>
which can be used to generate diagnostics when `cond` is a constant<br>
expression that evaluates to true. Otherwise no attribute has no<br>
effect.<br>
<br>
This patch adds _LIBCPP_DIAGNOSE_ERROR/WARNING macros which<br>
use this new attribute. Additionally this patch implements<br>
a diagnostic message when a non-const-callable comparator is<br>
given to a container.<br>
<br>
Note: For now the warning version of the diagnostic is useless<br>
within libc++ since warning diagnostics are suppressed by the<br>
system header pragma. I'm going to work on fixing this.<br>
<br>
Added:<br>
    libcxx/trunk/test/libcxx/conta<wbr>iners/associative/non_const_co<wbr>mparator.fail.cpp<br>
Modified:<br>
    libcxx/trunk/docs/UsingLibcxx.<wbr>rst<br>
    libcxx/trunk/include/__config<br>
    libcxx/trunk/include/__tree<br>
    libcxx/trunk/include/map<br>
    libcxx/trunk/include/type_trai<wbr>ts<br>
    libcxx/trunk/test/libcxx/compi<wbr>ler.py<br>
    libcxx/trunk/test/libcxx/test/<wbr>config.py<br>
    libcxx/trunk/test/libcxx/test/<wbr>format.py<br>
    libcxx/trunk/test/libcxx/utili<wbr>ties/tuple/tuple.tuple/diagnos<wbr>e_reference_binding.fail.cpp<br>
<br>
Modified: libcxx/trunk/docs/UsingLibcxx.<wbr>rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/UsingLibcxx.rst?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/docs/UsingL<wbr>ibcxx.rst?rev=291961&r1=291960<wbr>&r2=291961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/docs/UsingLibcxx.<wbr>rst (original)<br>
+++ libcxx/trunk/docs/UsingLibcxx.<wbr>rst Fri Jan 13 16:02:08 2017<br>
@@ -173,3 +173,10 @@ thread safety annotations.<br>
       return Tup{"hello world", 42}; // explicit constructor called. OK.<br>
     }<br>
<br>
+**_LIBCPP_DISABLE_ADDITIONAL_<wbr>DIAGNOSTICS**:<br>
+  This macro disables the additional diagnostics generated by libc++ using the<br>
+  `diagnose_if` attribute. These additional diagnostics include checks for:<br>
+<br>
+    * Giving `set`, `map`, `multiset`, `multimap` a comparator which is not<br>
+      const callable.<br>
+<br>
<br>
Modified: libcxx/trunk/include/__config<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/__c<wbr>onfig?rev=291961&r1=291960&r2=<wbr>291961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/__config (original)<br>
+++ libcxx/trunk/include/__config Fri Jan 13 16:02:08 2017<br>
@@ -1006,6 +1006,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit<br>
 #endif<br>
 #endif<br>
<br>
+#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDIT<wbr>IONAL_DIAGNOSTICS)<br>
+# define _LIBCPP_DIAGNOSE_WARNING(...) \<br>
+    __attribute__((__diagnose_if__<wbr>(__VA_ARGS__, "warning")))<br>
+# define _LIBCPP_DIAGNOSE_ERROR(...) \<br>
+    __attribute__((__diagnose_if__<wbr>(__VA_ARGS__, "error")))<br>
+#else<br>
+# define _LIBCPP_DIAGNOSE_WARNING(...)<br>
+# define _LIBCPP_DIAGNOSE_ERROR(...)<br>
+#endif<br>
+<br>
 #endif // __cplusplus<br>
<br>
 #endif // _LIBCPP_CONFIG<br>
<br>
Modified: libcxx/trunk/include/__tree<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/__t<wbr>ree?rev=291961&r1=291960&r2=29<wbr>1961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/__tree (original)<br>
+++ libcxx/trunk/include/__tree Fri Jan 13 16:02:08 2017<br>
@@ -41,6 +41,10 @@ template <class _Key, class _Value><br>
 struct __value_type;<br>
 #endif<br>
<br>
+template <class _Key, class _CP, class _Compare,<br>
+    bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::<wbr>value><br>
+class __map_value_compare;<br>
+<br>
 template <class _Allocator> class __map_node_destructor;<br>
 template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_iterator;<br>
 template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_const_iterator;<br>
@@ -955,6 +959,30 @@ private:<br>
<br>
 };<br>
<br>
+#ifndef _LIBCPP_CXX03_LANG<br>
+template <class _Tp, class _Compare, class _Allocator><br>
+struct __diagnose_tree_helper {<br>
+  static constexpr bool __trigger_diagnostics()<br>
+      _LIBCPP_DIAGNOSE_WARNING(!__is<wbr>_const_comparable<_Compare, _Tp>::value,<br>
+            "the specified comparator type does not provide a const call operator")<br>
+  { return true; }<br>
+};<br>
+<br>
+template <class _Key, class _Value, class _KeyComp, class _Alloc><br>
+struct __diagnose_tree_helper<<br>
+    __value_type<_Key, _Value>,<br>
+    __map_value_compare<_Key, __value_type<_Key, _Value>, _KeyComp>,<br>
+    _Alloc<br>
+><br>
+{<br>
+  static constexpr bool __trigger_diagnostics()<br>
+      _LIBCPP_DIAGNOSE_WARNING(!__is<wbr>_const_comparable<_KeyComp, _Key>::value,<br>
+            "the specified comparator type does not provide a const call operator")<br>
+  { return true; }<br>
+};<br>
+<br>
+#endif<br>
+<br>
 template <class _Tp, class _Compare, class _Allocator><br>
 class __tree<br>
 {<br>
@@ -1787,7 +1815,11 @@ __tree<_Tp, _Compare, _Allocator>::~__tr<br>
 {<br>
     static_assert((is_copy_constr<wbr>uctible<value_compare>::value)<wbr>,<br>
                  "Comparator must be copy-constructible.");<br>
-    destroy(__root());<br>
+#ifndef _LIBCPP_CXX03_LANG<br>
+    static_assert((__diagnose_tree<wbr>_helper<_Tp, _Compare, _Allocator>::<br>
+                     __trigger_diagnostics()), "");<br>
+#endif<br>
+  destroy(__root());<br>
 }<br>
<br>
 template <class _Tp, class _Compare, class _Allocator><br>
<br>
Modified: libcxx/trunk/include/map<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/map<wbr>?rev=291961&r1=291960&r2=29196<wbr>1&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/map (original)<br>
+++ libcxx/trunk/include/map Fri Jan 13 16:02:08 2017<br>
@@ -453,9 +453,7 @@ swap(multimap<Key, T, Compare, Allocator<br>
<br>
 _LIBCPP_BEGIN_NAMESPACE_STD<br>
<br>
-template <class _Key, class _CP, class _Compare,<br>
-          bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::<wbr>value<br>
-         ><br>
+template <class _Key, class _CP, class _Compare, bool _IsSmall><br>
 class __map_value_compare<br>
     : private _Compare<br>
 {<br>
<br>
Modified: libcxx/trunk/include/type_trai<wbr>ts<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/include/typ<wbr>e_traits?rev=291961&r1=291960&<wbr>r2=291961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/type_trai<wbr>ts (original)<br>
+++ libcxx/trunk/include/type_trai<wbr>ts Fri Jan 13 16:02:08 2017<br>
@@ -4715,6 +4715,15 @@ struct __can_extract_map_key<_ValTy, _Ke<br>
<br>
 #endif<br>
<br>
+template <class _Comp, class _ValueType, class = void><br>
+struct __is_const_comparable : false_type {};<br>
+<br>
+template <class _Comp, class _ValueType><br>
+struct __is_const_comparable<_Comp, _ValueType, typename __void_t<<br>
+    decltype(_VSTD::declval<_Comp const&>()(_VSTD::declval<_Valu<wbr>eType const&>(),<br>
+                                            _VSTD::declval<_ValueType const&>()))<br>
+  >::type> : true_type {};<br>
+<br>
 _LIBCPP_END_NAMESPACE_STD<br>
<br>
 #endif  // _LIBCPP_TYPE_TRAITS<br>
<br>
Modified: libcxx/trunk/test/libcxx/compi<wbr>ler.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/compiler.py?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/compiler.py?rev=291961&r1=291<wbr>960&r2=291961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/compi<wbr>ler.py (original)<br>
+++ libcxx/trunk/test/libcxx/compi<wbr>ler.py Fri Jan 13 16:02:08 2017<br>
@@ -296,7 +296,7 @@ class CXXCompiler(object):<br>
<br>
     def addWarningFlagIfSupported(self<wbr>, flag):<br>
         if self.hasWarningFlag(flag):<br>
-            assert flag not in self.warning_flags<br>
-            self.warning_flags += [flag]<br>
+            if flag not in self.warning_flags:<br>
+                self.warning_flags += [flag]<br>
             return True<br>
         return False<br>
<br>
Added: libcxx/trunk/test/libcxx/conta<wbr>iners/associative/non_const_co<wbr>mparator.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/associative/non_const_comparator.fail.cpp?rev=291961&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/containers/associative/non_co<wbr>nst_comparator.fail.cpp?rev=29<wbr>1961&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/conta<wbr>iners/associative/non_const_co<wbr>mparator.fail.cpp (added)<br>
+++ libcxx/trunk/test/libcxx/conta<wbr>iners/associative/non_const_co<wbr>mparator.fail.cpp Fri Jan 13 16:02:08 2017<br>
@@ -0,0 +1,45 @@<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
+<br>
+// UNSUPPORTED: c++98, c++03<br>
+// REQUIRES: diagnose-if-support, verify-support<br>
+<br>
+// Test that libc++ generates a warning diagnostic when the container is<br>
+// provided a non-const callable comparator.<br>
+<br>
+#include <set><br>
+#include <map><br>
+<br>
+struct BadCompare {<br>
+  template <class T, class U><br>
+  bool operator()(T const& t, U const& u) {<br>
+    return t < u;<br>
+  }<br>
+};<br>
+<br>
+int main() {<br>
+  static_assert(!std::__is_const<wbr>_comparable<BadCompare, int>::value, "");<br>
+  // expected-warning@__tree:* 4 {{the specified comparator type does not provide a const call operator}}<br>
+  {<br>
+    using C = std::set<int, BadCompare>;<br>
+    C s;<br>
+  }<br>
+  {<br>
+    using C = std::multiset<long, BadCompare>;<br>
+    C s;<br>
+  }<br>
+  {<br>
+    using C = std::map<int, int, BadCompare>;<br>
+    C s;<br>
+  }<br>
+  {<br>
+    using C = std::multimap<long, int, BadCompare>;<br>
+    C s;<br>
+  }<br>
+}<br>
<br>
Modified: libcxx/trunk/test/libcxx/test/<wbr>config.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/test/config.py?rev=291961&r1=<wbr>291960&r2=291961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/test/<wbr>config.py (original)<br>
+++ libcxx/trunk/test/libcxx/test/<wbr>config.py Fri Jan 13 16:02:08 2017<br>
@@ -712,33 +712,35 @@ class Configuration(object):<br>
                 ['c++11', 'c++14', 'c++1z'])) != 0<br>
         enable_warnings = self.get_lit_bool('enable_warn<wbr>ings',<br>
                                             default_enable_warnings)<br>
-        if enable_warnings:<br>
-            self.cxx.useWarnings(True)<br>
-            self.cxx.warning_flags += [<br>
-                '-D_LIBCPP_HAS_NO_PRAGMA_SYSTE<wbr>M_HEADER',<br>
-                '-Wall', '-Wextra', '-Werror'<br>
-            ]<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wshadow')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-unused-command-line<wbr>-argument')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-attributes')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-pessimizing-move')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-c++11-extensions')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-user-defined-litera<wbr>ls')<br>
-            # These warnings should be enabled in order to support the MSVC<br>
-            # team using the test suite; They enable the warnings below and<br>
-            # expect the test suite to be clean.<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wsign-compare')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wunused-variable')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wunused-parameter')<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wunreachable-code')<br>
-            # FIXME: Enable the two warnings below.<br>
-            self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-conversion')<br>
+        self.cxx.useWarnings(enable_wa<wbr>rnings)<br>
+        self.cxx.warning_flags += [<br>
+            '-D_LIBCPP_HAS_NO_PRAGMA_SYSTE<wbr>M_HEADER',<br>
+            '-Wall', '-Wextra', '-Werror'<br>
+        ]<br>
+        if self.cxx.hasWarningFlag('-Wuse<wbr>r-defined-warnings'):<br>
+            self.cxx.warning_flags += ['-Wuser-defined-warnings']<br>
+            self.config.available_features<wbr>.add('diagnose-if-support')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wshadow')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-unused-command-line<wbr>-argument')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-attributes')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-pessimizing-move')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-c++11-extensions')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-user-defined-litera<wbr>ls')<br>
+        # These warnings should be enabled in order to support the MSVC<br>
+        # team using the test suite; They enable the warnings below and<br>
+        # expect the test suite to be clean.<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wsign-compare')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wunused-variable')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wunused-parameter')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wunreachable-code')<br>
+        # FIXME: Enable the two warnings below.<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-conversion')<br>
+        self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-unused-local-typede<wbr>f')<br>
+        std = self.get_lit_conf('std', None)<br>
+        if std in ['c++98', 'c++03']:<br>
+            # The '#define static_assert' provided by libc++ in C++03 mode<br>
+            # causes an unused local typedef whenever it is used.<br>
             self.cxx.addWarningFlagIfSupp<wbr>orted('-Wno-unused-local-typed<wbr>ef')<br>
-            std = self.get_lit_conf('std', None)<br>
-            if std in ['c++98', 'c++03']:<br>
-                # The '#define static_assert' provided by libc++ in C++03 mode<br>
-                # causes an unused local typedef whenever it is used.<br>
-                self.cxx.addWarningFlagIfSuppo<wbr>rted('-Wno-unused-local-typede<wbr>f')<br>
<br>
     def configure_sanitizer(self):<br>
         san = self.get_lit_conf('use_sanitiz<wbr>er', '').strip()<br>
<br>
Modified: libcxx/trunk/test/libcxx/test/<wbr>format.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/test/format.py?rev=291961&r1=<wbr>291960&r2=291961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/test/<wbr>format.py (original)<br>
+++ libcxx/trunk/test/libcxx/test/<wbr>format.py Fri Jan 13 16:02:08 2017<br>
@@ -223,6 +223,10 @@ class LibcxxTestFormat(object):<br>
             test_cxx.flags += ['-fsyntax-only']<br>
         if use_verify:<br>
             test_cxx.useVerify()<br>
+            test_cxx.useWarnings()<br>
+            if '-Wuser-defined-warnings' in test_cxx.warning_flags:<br>
+                test_cxx.warning_flags += ['-Wno-error=user-defined-warn<wbr>ings']<br>
+<br>
         cmd, out, err, rc = test_cxx.compile(source_path, out=os.devnull)<br>
         expected_rc = 0 if use_verify else 1<br>
         if rc == expected_rc:<br>
<br>
Modified: libcxx/trunk/test/libcxx/utili<wbr>ties/tuple/tuple.tuple/diagnos<wbr>e_reference_binding.fail.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp?rev=291961&r1=291960&r2=291961&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/libcxx/trunk/test/libcxx<wbr>/utilities/tuple/tuple.tuple/d<wbr>iagnose_reference_binding.fail<wbr>.cpp?rev=291961&r1=291960&r2=2<wbr>91961&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/utili<wbr>ties/tuple/tuple.tuple/diagnos<wbr>e_reference_binding.fail.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/utili<wbr>ties/tuple/tuple.tuple/diagnos<wbr>e_reference_binding.fail.cpp Fri Jan 13 16:02:08 2017<br>
@@ -30,4 +30,11 @@ int main() {<br>
     // bind rvalue to constructed non-rvalue<br>
     std::tuple<std::string &&> t2("hello"); // expected-note {{requested here}}<br>
     std::tuple<std::string &&> t3(std::allocator_arg, alloc, "hello"); // expected-note {{requested here}}<br>
+<br>
+    // FIXME: The below warnings may get emitted as an error, a warning, or not emitted at all<br>
+    // depending on the flags used to compile this test.<br>
+  {<br>
+    // expected-warning@tuple:* 0+ {{binding reference member 'value' to a temporary value}}<br>
+    // expected-error@tuple:* 0+ {{binding reference member 'value' to a temporary value}}<br>
+  }<br>
 }<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>