Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 42b8581

Browse files
Solving the following compile time error
error: moving ‘a’ of type ‘arduino::String’ to itself [-Werror=self-move] Which may happen if if GCC_VERSION is not defined, and instead __GNUC__ is defined
1 parent 2aaef7b commit 42b8581

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎test/src/String/test_move.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ TEST_CASE("Testing String move assignment", "[String-move-02]")
3737

3838
TEST_CASE("Testing String move self assignment", "[String-move-03]")
3939
{
40-
#if (defined(GCC_VERSION) && GCC_VERSION >= 13) || (defined(__clang_major__) && __clang_major__ >= 14)
40+
#if (defined(GCC_VERSION) && GCC_VERSION >= 13) || (defined(__clang_major__) && __clang_major__ >= 14) \
41+
|| (defined(__GNUC__) && __GNUC__ >= 13)
4142
#pragma GCC diagnostic push
4243
#pragma GCC diagnostic ignored "-Wself-move"
4344
#endif
4445
arduino::String a("src");
4546
a = std::move(a);
4647
REQUIRE(a == "src");
47-
#if defined(GCC_VERSION) && GCC_VERSION >= 13
48+
#if defined(GCC_VERSION) && GCC_VERSION >= 13 || (defined(__clang_major__) && __clang_major__ >= 14) \
49+
|| (defined(__GNUC__) && __GNUC__ >= 13)
4850
#pragma GCC diagnostic pop
4951
#endif
5052
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /