@@ -100,13 +100,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @endcond
constexpr memory_order
- operator|(memory_order __m, __memory_order_modifier __mod)
+ operator|(memory_order __m, __memory_order_modifier __mod) noexcept
{
return memory_order(int(__m) | int(__mod));
}
constexpr memory_order
- operator&(memory_order __m, __memory_order_modifier __mod)
+ operator&(memory_order __m, __memory_order_modifier __mod) noexcept
{
return memory_order(int(__m) & int(__mod));
}
@@ -91,6 +91,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates copy_options
+ [[nodiscard]]
constexpr copy_options
operator&(copy_options __x, copy_options __y) noexcept
{
@@ -99,6 +100,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr copy_options
operator|(copy_options __x, copy_options __y) noexcept
{
@@ -107,6 +109,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr copy_options
operator^(copy_options __x, copy_options __y) noexcept
{
@@ -115,6 +118,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr copy_options
operator~(copy_options __x) noexcept
{
@@ -161,6 +165,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates perms
+ [[nodiscard]]
constexpr perms
operator&(perms __x, perms __y) noexcept
{
@@ -169,6 +174,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr perms
operator|(perms __x, perms __y) noexcept
{
@@ -177,6 +183,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr perms
operator^(perms __x, perms __y) noexcept
{
@@ -185,6 +192,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr perms
operator~(perms __x) noexcept
{
@@ -215,6 +223,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates perm_options
+ [[nodiscard]]
constexpr perm_options
operator&(perm_options __x, perm_options __y) noexcept
{
@@ -223,6 +232,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr perm_options
operator|(perm_options __x, perm_options __y) noexcept
{
@@ -231,6 +241,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr perm_options
operator^(perm_options __x, perm_options __y) noexcept
{
@@ -239,6 +250,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr perm_options
operator~(perm_options __x) noexcept
{
@@ -266,6 +278,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates directory_options
+ [[nodiscard]]
constexpr directory_options
operator&(directory_options __x, directory_options __y) noexcept
{
@@ -274,6 +287,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr directory_options
operator|(directory_options __x, directory_options __y) noexcept
{
@@ -282,6 +296,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr directory_options
operator^(directory_options __x, directory_options __y) noexcept
{
@@ -290,6 +305,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[nodiscard]]
constexpr directory_options
operator~(directory_options __x) noexcept
{
@@ -79,32 +79,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_ios_fmtflags_min = ~__INT_MAX__
};
- inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
- operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Fmtflags
+ operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
{ return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
- operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Fmtflags
+ operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
{ return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
- operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Fmtflags
+ operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
- operator~(_Ios_Fmtflags __a)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Fmtflags
+ operator~(_Ios_Fmtflags __a) _GLIBCXX_NOTHROW
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Fmtflags&
- operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
{ return __a = __a | __b; }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Fmtflags&
- operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
{ return __a = __a & __b; }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Fmtflags&
- operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
{ return __a = __a ^ __b; }
@@ -122,32 +129,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_ios_openmode_min = ~__INT_MAX__
};
- inline _GLIBCXX_CONSTEXPR _Ios_Openmode
- operator&(_Ios_Openmode __a, _Ios_Openmode __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Openmode
+ operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
{ return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Openmode
- operator|(_Ios_Openmode __a, _Ios_Openmode __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Openmode
+ operator|(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
{ return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Openmode
- operator^(_Ios_Openmode __a, _Ios_Openmode __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Openmode
+ operator^(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Openmode
- operator~(_Ios_Openmode __a)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Openmode
+ operator~(_Ios_Openmode __a) _GLIBCXX_NOTHROW
{ return _Ios_Openmode(~static_cast<int>(__a)); }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Openmode&
- operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
{ return __a = __a | __b; }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Openmode&
- operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
{ return __a = __a & __b; }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Openmode&
- operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
{ return __a = __a ^ __b; }
@@ -162,32 +176,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_ios_iostate_min = ~__INT_MAX__
};
- inline _GLIBCXX_CONSTEXPR _Ios_Iostate
- operator&(_Ios_Iostate __a, _Ios_Iostate __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Iostate
+ operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
{ return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Iostate
- operator|(_Ios_Iostate __a, _Ios_Iostate __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Iostate
+ operator|(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
{ return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Iostate
- operator^(_Ios_Iostate __a, _Ios_Iostate __b)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Iostate
+ operator^(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _GLIBCXX_CONSTEXPR _Ios_Iostate
- operator~(_Ios_Iostate __a)
+ _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
+ inline _Ios_Iostate
+ operator~(_Ios_Iostate __a) _GLIBCXX_NOTHROW
{ return _Ios_Iostate(~static_cast<int>(__a)); }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Iostate&
- operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
{ return __a = __a | __b; }
+ _GLIBCXX14_CONSTEXPR
inline const _Ios_Iostate&
- operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
{ return __a = __a & __b; }
- inline const _Ios_Iostate&
- operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ _GLIBCXX14_CONSTEXPR
+ inline const _Ios_Iostate&
+ operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
{ return __a = __a ^ __b; }
@@ -186,44 +186,48 @@ namespace regex_constants
*/
_GLIBCXX17_INLINE constexpr syntax_option_type __polynomial = _S_polynomial;
- constexpr inline syntax_option_type
- operator&(syntax_option_type __a, syntax_option_type __b)
+ [[__nodiscard__]]
+ constexpr syntax_option_type
+ operator&(syntax_option_type __a, syntax_option_type __b) noexcept
{
return (syntax_option_type)(static_cast<unsigned int>(__a)
& static_cast<unsigned int>(__b));
}
- constexpr inline syntax_option_type
- operator|(syntax_option_type __a, syntax_option_type __b)
+ [[__nodiscard__]]
+ constexpr syntax_option_type
+ operator|(syntax_option_type __a, syntax_option_type __b) noexcept
{
return (syntax_option_type)(static_cast<unsigned int>(__a)
| static_cast<unsigned int>(__b));
}
- constexpr inline syntax_option_type
- operator^(syntax_option_type __a, syntax_option_type __b)
+ [[__nodiscard__]]
+ constexpr syntax_option_type
+ operator^(syntax_option_type __a, syntax_option_type __b) noexcept
{
return (syntax_option_type)(static_cast<unsigned int>(__a)
^ static_cast<unsigned int>(__b));
}
- constexpr inline syntax_option_type
- operator~(syntax_option_type __a)
+ [[__nodiscard__]]
+ constexpr syntax_option_type
+ operator~(syntax_option_type __a) noexcept
{ return (syntax_option_type)(~static_cast<unsigned int>(__a)); }
_GLIBCXX14_CONSTEXPR
inline syntax_option_type&
- operator&=(syntax_option_type& __a, syntax_option_type __b)
+ operator&=(syntax_option_type& __a, syntax_option_type __b) noexcept
{ return __a = __a & __b; }
_GLIBCXX14_CONSTEXPR
inline syntax_option_type&
- operator|=(syntax_option_type& __a, syntax_option_type __b)
+ operator|=(syntax_option_type& __a, syntax_option_type __b) noexcept
{ return __a = __a | __b; }
_GLIBCXX14_CONSTEXPR
inline syntax_option_type&
- operator^=(syntax_option_type& __a, syntax_option_type __b)
+ operator^=(syntax_option_type& __a, syntax_option_type __b) noexcept
{ return __a = __a ^ __b; }
///@}
@@ -367,44 +371,48 @@ namespace regex_constants
*/
_GLIBCXX17_INLINE constexpr match_flag_type format_first_only = _S_first_only;
- constexpr inline match_flag_type
- operator&(match_flag_type __a, match_flag_type __b)
+ [[__nodiscard__]]
+ constexpr match_flag_type
+ operator&(match_flag_type __a, match_flag_type __b) noexcept
{
return (match_flag_type)(static_cast<unsigned int>(__a)
& static_cast<unsigned int>(__b));
}
- constexpr inline match_flag_type
- operator|(match_flag_type __a, match_flag_type __b)
+ [[__nodiscard__]]
+ constexpr match_flag_type
+ operator|(match_flag_type __a, match_flag_type __b) noexcept
{
return (match_flag_type)(static_cast<unsigned int>(__a)
| static_cast<unsigned int>(__b));
}
- constexpr inline match_flag_type
- operator^(match_flag_type __a, match_flag_type __b)
+ [[__nodiscard__]]
+ constexpr match_flag_type
+ operator^(match_flag_type __a, match_flag_type __b) noexcept
{
return (match_flag_type)(static_cast<unsigned int>(__a)
^ static_cast<unsigned int>(__b));
}
- constexpr inline match_flag_type
- operator~(match_flag_type __a)
+ [[__nodiscard__]]
+ constexpr match_flag_type
+ operator~(match_flag_type __a) noexcept
{ return (match_flag_type)(~static_cast<unsigned int>(__a)); }
_GLIBCXX14_CONSTEXPR
inline match_flag_type&
- operator&=(match_flag_type& __a, match_flag_type __b)
+ operator&=(match_flag_type& __a, match_flag_type __b) noexcept
{ return __a = __a & __b; }
_GLIBCXX14_CONSTEXPR
inline match_flag_type&
- operator|=(match_flag_type& __a, match_flag_type __b)
+ operator|=(match_flag_type& __a, match_flag_type __b) noexcept
{ return __a = __a | __b; }
_GLIBCXX14_CONSTEXPR
inline match_flag_type&
- operator^=(match_flag_type& __a, match_flag_type __b)
+ operator^=(match_flag_type& __a, match_flag_type __b) noexcept
{ return __a = __a ^ __b; }
///@}
@@ -102,6 +102,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates copy_options
+ [[__nodiscard__]]
constexpr copy_options
operator&(copy_options __x, copy_options __y) noexcept
{
@@ -110,6 +111,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr copy_options
operator|(copy_options __x, copy_options __y) noexcept
{
@@ -118,6 +120,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr copy_options
operator^(copy_options __x, copy_options __y) noexcept
{
@@ -126,6 +129,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr copy_options
operator~(copy_options __x) noexcept
{
@@ -174,6 +178,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates std::experimental::filesystem::perms
+ [[__nodiscard__]]
constexpr perms
operator&(perms __x, perms __y) noexcept
{
@@ -182,6 +187,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr perms
operator|(perms __x, perms __y) noexcept
{
@@ -190,6 +196,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr perms
operator^(perms __x, perms __y) noexcept
{
@@ -198,6 +205,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr perms
operator~(perms __x) noexcept
{
@@ -225,6 +233,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// @{
/// @relates directory_options
+ [[__nodiscard__]]
constexpr directory_options
operator&(directory_options __x, directory_options __y) noexcept
{
@@ -233,6 +242,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) & static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr directory_options
operator|(directory_options __x, directory_options __y) noexcept
{
@@ -241,6 +251,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) | static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr directory_options
operator^(directory_options __x, directory_options __y) noexcept
{
@@ -249,6 +260,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
static_cast<__utype>(__x) ^ static_cast<__utype>(__y));
}
+ [[__nodiscard__]]
constexpr directory_options
operator~(directory_options __x) noexcept
{
@@ -622,18 +622,22 @@ namespace __detail
scientific = 1, fixed = 2, hex = 4, general = fixed | scientific
};
+ [[nodiscard]]
constexpr chars_format
operator|(chars_format __lhs, chars_format __rhs) noexcept
{ return (chars_format)((unsigned)__lhs | (unsigned)__rhs); }
+ [[nodiscard]]
constexpr chars_format
operator&(chars_format __lhs, chars_format __rhs) noexcept
{ return (chars_format)((unsigned)__lhs & (unsigned)__rhs); }
+ [[nodiscard]]
constexpr chars_format
operator^(chars_format __lhs, chars_format __rhs) noexcept
{ return (chars_format)((unsigned)__lhs ^ (unsigned)__rhs); }
+ [[nodiscard]]
constexpr chars_format
operator~(chars_format __fmt) noexcept
{ return (chars_format)~(unsigned)__fmt; }
@@ -152,33 +152,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
deferred = 2
};
+ [[__nodiscard__]]
constexpr launch operator&(launch __x, launch __y) noexcept
{
return static_cast<launch>(
static_cast<int>(__x) & static_cast<int>(__y));
}
+ [[__nodiscard__]]
constexpr launch operator|(launch __x, launch __y) noexcept
{
return static_cast<launch>(
static_cast<int>(__x) | static_cast<int>(__y));
}
+ [[__nodiscard__]]
constexpr launch operator^(launch __x, launch __y) noexcept
{
return static_cast<launch>(
static_cast<int>(__x) ^ static_cast<int>(__y));
}
+ [[__nodiscard__]]
constexpr launch operator~(launch __x) noexcept
{ return static_cast<launch>(~static_cast<int>(__x)); }
+ _GLIBCXX14_CONSTEXPR
inline launch& operator&=(launch& __x, launch __y) noexcept
{ return __x = __x & __y; }
+ _GLIBCXX14_CONSTEXPR
inline launch& operator|=(launch& __x, launch __y) noexcept
{ return __x = __x | __y; }
+ _GLIBCXX14_CONSTEXPR
inline launch& operator^=(launch& __x, launch __y) noexcept
{ return __x = __x ^ __y; }
new file mode 100644
@@ -0,0 +1,56 @@
+// { dg-do compile { target c++17 } }
+#include <filesystem>
+
+namespace fs = std::filesystem;
+
+void
+test_copy_options()
+{
+ using T = fs::copy_options;
+ constexpr T val = T::none;
+ constexpr T all = ((val | val) & val) ^ ~val;
+ static_assert( noexcept(((val | val) & val) ^ ~val) );
+ val & val; // { dg-warning "ignoring return value" }
+ val | val; // { dg-warning "ignoring return value" }
+ val ^ val; // { dg-warning "ignoring return value" }
+ ~val; // { dg-warning "ignoring return value" }
+}
+
+void
+test_perms()
+{
+ using T = fs::perms;
+ constexpr T val = T::none;
+ constexpr T all = ((val | val) & val) ^ ~val;
+ static_assert( noexcept(((val | val) & val) ^ ~val) );
+ val & val; // { dg-warning "ignoring return value" }
+ val | val; // { dg-warning "ignoring return value" }
+ val ^ val; // { dg-warning "ignoring return value" }
+ ~val; // { dg-warning "ignoring return value" }
+}
+
+void
+test_perm_options()
+{
+ using T = fs::perm_options;
+ constexpr T val = T::replace;
+ constexpr T all = ((val | val) & val) ^ ~val;
+ static_assert( noexcept(((val | val) & val) ^ ~val) );
+ val & val; // { dg-warning "ignoring return value" }
+ val | val; // { dg-warning "ignoring return value" }
+ val ^ val; // { dg-warning "ignoring return value" }
+ ~val; // { dg-warning "ignoring return value" }
+}
+
+void
+test_directory_options()
+{
+ using T = fs::directory_options;
+ constexpr T val = T::none;
+ constexpr T all = ((val | val) & val) ^ ~val;
+ static_assert( noexcept(((val | val) & val) ^ ~val) );
+ val & val; // { dg-warning "ignoring return value" }
+ val | val; // { dg-warning "ignoring return value" }
+ val ^ val; // { dg-warning "ignoring return value" }
+ ~val; // { dg-warning "ignoring return value" }
+}
@@ -27,3 +27,7 @@ int main()
{
__gnu_test::bitmask_operators<std::ios_base::fmtflags>();
}
+// { dg-warning "ignoring return value.*operator\\|" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator&" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator\\^" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator~" "" { target c++17 } 0 }
@@ -27,3 +27,7 @@ int main()
{
__gnu_test::bitmask_operators<std::ios_base::iostate>();
}
+// { dg-warning "ignoring return value.*operator\\|" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator&" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator\\^" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator~" "" { target c++17 } 0 }
@@ -27,3 +27,7 @@ int main()
{
__gnu_test::bitmask_operators<std::ios_base::openmode>();
}
+// { dg-warning "ignoring return value.*operator\\|" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator&" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator\\^" "" { target c++17 } 0 }
+// { dg-warning "ignoring return value.*operator~" "" { target c++17 } 0 }