From: Alexander Stein <alexander.stein@mailbox.org>
Date: Wed, 7 Aug 2019 19:51:31 +0000 (+0200)
Subject: bindings: cxx: vix compile errors
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0226d42883a4d5090191eb9c769c8ddc40fc9c65;p=qemu-gpiodev%2Flibgpiod.git

bindings: cxx: vix compile errors

This fixes the following compile errors:
tests-event.cpp:152:3: error: cannot declare reference to
'class std::system_error&', which is not a typedef or a template type
argument
  152 |   REQUIRE_THROWS_AS(line.event_get_fd(), ::std::system_error&);

This occurs on catch2 but not on catch.

Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---

diff --git a/bindings/cxx/tests/tests-chip.cpp b/bindings/cxx/tests/tests-chip.cpp
index 11c2d4c..c9eb8e5 100644
--- a/bindings/cxx/tests/tests-chip.cpp
+++ b/bindings/cxx/tests/tests-chip.cpp
@@ -107,7 +107,7 @@ TEST_CASE("Uninitialized GPIO chip behaves correctly", "[chip]")
 
 	SECTION("using uninitialized chip throws logic_error")
 	{
-		REQUIRE_THROWS_AS(chip.name(), ::std::logic_error&);
+		REQUIRE_THROWS_AS(chip.name(), ::std::logic_error);
 	}
 }
 
@@ -139,7 +139,7 @@ TEST_CASE("GPIO chip can be opened with the open() method with implicit lookup",
 
 TEST_CASE("Trying to open a nonexistent chip throws system_error", "[chip]")
 {
-	REQUIRE_THROWS_AS(::gpiod::chip("nonexistent-chip"), ::std::system_error&);
+	REQUIRE_THROWS_AS(::gpiod::chip("nonexistent-chip"), ::std::system_error);
 }
 
 TEST_CASE("Chip object can be reset", "[chip]")
@@ -244,12 +244,12 @@ TEST_CASE("Errors occurring when retrieving lines are correctly reported", "[chi
 
 	SECTION("invalid offset (single line)")
 	{
-		REQUIRE_THROWS_AS(chip.get_line(9), ::std::out_of_range&);
+		REQUIRE_THROWS_AS(chip.get_line(9), ::std::out_of_range);
 	}
 
 	SECTION("invalid offset (multiple lines)")
 	{
-		REQUIRE_THROWS_AS(chip.get_lines({ 1, 19, 4, 7 }), ::std::out_of_range&);
+		REQUIRE_THROWS_AS(chip.get_lines({ 1, 19, 4, 7 }), ::std::out_of_range);
 	}
 
 	SECTION("line not found by name")
diff --git a/bindings/cxx/tests/tests-event.cpp b/bindings/cxx/tests/tests-event.cpp
index b34347f..b41cf7e 100644
--- a/bindings/cxx/tests/tests-event.cpp
+++ b/bindings/cxx/tests/tests-event.cpp
@@ -149,7 +149,7 @@ TEST_CASE("It's possible to retrieve the event file descriptor", "[event][line]"
 
 	SECTION("error if not requested")
 	{
-		REQUIRE_THROWS_AS(line.event_get_fd(), ::std::system_error&);
+		REQUIRE_THROWS_AS(line.event_get_fd(), ::std::system_error);
 	}
 
 	SECTION("error if requested for values")
@@ -157,7 +157,7 @@ TEST_CASE("It's possible to retrieve the event file descriptor", "[event][line]"
 		config.request_type = ::gpiod::line_request::DIRECTION_INPUT;
 
 		line.request(config);
-		REQUIRE_THROWS_AS(line.event_get_fd(), ::std::system_error&);
+		REQUIRE_THROWS_AS(line.event_get_fd(), ::std::system_error);
 	}
 }
 
diff --git a/bindings/cxx/tests/tests-line.cpp b/bindings/cxx/tests/tests-line.cpp
index df89156..9e7e1b0 100644
--- a/bindings/cxx/tests/tests-line.cpp
+++ b/bindings/cxx/tests/tests-line.cpp
@@ -131,7 +131,7 @@ TEST_CASE("Line bulk object works correctly", "[line][bulk]")
 	{
 		auto lines = chip.get_all_lines();
 
-		REQUIRE_THROWS_AS(lines.get(11), ::std::out_of_range&);
+		REQUIRE_THROWS_AS(lines.get(11), ::std::out_of_range);
 	}
 }
 
@@ -251,7 +251,7 @@ TEST_CASE("Exported line can be released", "[line]")
 	line.release();
 
 	REQUIRE_FALSE(line.is_requested());
-	REQUIRE_THROWS_AS(line.get_value(), ::std::system_error&);
+	REQUIRE_THROWS_AS(line.get_value(), ::std::system_error);
 }
 
 TEST_CASE("Uninitialized GPIO line behaves correctly", "[line]")
@@ -265,7 +265,7 @@ TEST_CASE("Uninitialized GPIO line behaves correctly", "[line]")
 
 	SECTION("using uninitialized line throws logic_error")
 	{
-		REQUIRE_THROWS_AS(line.name(), ::std::logic_error&);
+		REQUIRE_THROWS_AS(line.name(), ::std::logic_error);
 	}
 }
 
@@ -280,7 +280,7 @@ TEST_CASE("Uninitialized GPIO line_bulk behaves correctly", "[line][bulk]")
 
 	SECTION("using uninitialized line_bulk throws logic_error")
 	{
-		REQUIRE_THROWS_AS(bulk.get(0), ::std::logic_error&);
+		REQUIRE_THROWS_AS(bulk.get(0), ::std::logic_error);
 	}
 }
 
@@ -298,7 +298,7 @@ TEST_CASE("Cannot request the same line twice", "[line]")
 		auto line = chip.get_line(3);
 
 		REQUIRE_NOTHROW(line.request(config));
-		REQUIRE_THROWS_AS(line.request(config), ::std::system_error&);
+		REQUIRE_THROWS_AS(line.request(config), ::std::system_error);
 	}
 
 	SECTION("request the same line twice in line_bulk")
@@ -309,7 +309,7 @@ TEST_CASE("Cannot request the same line twice", "[line]")
 		 */
 		auto lines = chip.get_lines({ 2, 3, 4, 4 });
 
-		REQUIRE_THROWS_AS(lines.request(config), ::std::system_error&);
+		REQUIRE_THROWS_AS(lines.request(config), ::std::system_error);
 	}
 }
 
@@ -321,12 +321,12 @@ TEST_CASE("Cannot get/set values of unrequested lines", "[line]")
 
 	SECTION("get value")
 	{
-		REQUIRE_THROWS_AS(line.get_value(), ::std::system_error&);
+		REQUIRE_THROWS_AS(line.get_value(), ::std::system_error);
 	}
 
 	SECTION("set value")
 	{
-		REQUIRE_THROWS_AS(line.set_value(1), ::std::system_error&);
+		REQUIRE_THROWS_AS(line.set_value(1), ::std::system_error);
 	}
 }