Skip to content

Commit

Permalink
Fix clang-tidy findings
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Feb 13, 2018
1 parent e92e156 commit a9f628d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
10 changes: 6 additions & 4 deletions include/tao/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ namespace tao
template< typename T >
class incrementable
{
friend T operator++(T& arg, int)noexcept( noexcept( T( arg ), ++arg, T( std::declval< T >() ) ) )
friend T operator++( T& arg, int /*unused*/ ) noexcept( noexcept( T( arg ), ++arg, T( std::declval< T >() ) ) ) // NOLINT
{
const T nrv( arg );
++arg;
Expand All @@ -592,7 +592,7 @@ namespace tao
template< typename T >
class decrementable
{
friend T operator--(T& arg, int)noexcept( noexcept( T( arg ), --arg, T( std::declval< T >() ) ) )
friend T operator--( T& arg, int /*unused*/ ) noexcept( noexcept( T( arg ), --arg, T( std::declval< T >() ) ) ) // NOLINT
{
const T nrv( arg );
--arg;
Expand All @@ -606,8 +606,10 @@ namespace tao
decrementable< T >
{
};
}
}

} // namespace operators

} // namespace tao

#undef TAO_OPERATORS_BASIC_OP
#undef TAO_OPERATORS_BASIC_OP_LEFT
Expand Down
21 changes: 12 additions & 9 deletions src/test/operators/operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ class X
{
}

X( const X& x )
noexcept
: v_( x.v_ )
{
}
X( const X& ) = default;
X( X&& ) = default;

~X() = default;

X& operator=( const X& ) = delete;
X& operator=( X&& ) = delete;

X& operator+=( const X& x ) noexcept
{
Expand Down Expand Up @@ -118,24 +120,25 @@ class E
{
};

void adl_test( const E& ) {}
void adl_test( const E& /*unused*/ ) {}

namespace tao
{
void adl_test( const E& );
}

} // namespace tao

struct S
: tao::operators::addable< S >
{
S() {}
S() = default;

S( const S& a, const S& b )
: S( a + b )
{
}

S& operator+=( const S& ) noexcept
S& operator+=( const S& /*unused*/ ) noexcept
{
return *this;
}
Expand Down

0 comments on commit a9f628d

Please sign in to comment.