Bug #3384
closedscheduler-scoped-event-id.cpp error: static assertion failed: ScopedEventId must be MoveConstructible with noexcept
100%
Description
Hi,
I'am trying to build ndn-cxx-ndn-cxx-0.4.0 on Debian GNU/Linux "wheezy" 7.9, and the waf build script fail with :
[ 34/141] Compiling src/util/scheduler-scoped-event-id.cpp
../src/util/scheduler-scoped-event-id.cpp:29:1: error: static assertion failed: ScopedEventId must be MoveConstructible with noexcept
Waf: Leaving directory `/home/test/ndn-cxx-ndn-cxx-0.4.0/build'
Build failed
-> task in 'ndn-cxx' failed (exit status 1):
{task 144283660: cxx scheduler-scoped-event-id.cpp -> scheduler-scoped-event-id.cpp.2.o}
['/usr/bin/g++', '-O2', '-g', '-pedantic', '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-std=c++11', '-fPIC', '-include', '/home/test/ndn-cxx-ndn-cxx-0.4.0/build/ndn-cxx.2', '-I/home/test/ndn-cxx-ndn-cxx-0.4.0/build', '-I/home/test/ndn-cxx-ndn-cxx-0.4.0', '-I/home/test/ndn-cxx-ndn-cxx-0.4.0/build/src', '-I/home/test/ndn-cxx-ndn-cxx-0.4.0/src', '-I/usr/include', '-D_GLIBCXX_USE_NANOSLEEP', '-DNDEBUG', '../src/util/scheduler-scoped-event-id.cpp', '-c', '-o', '/home/test/ndn-cxx-ndn-cxx-0.4.0/build/src/util/scheduler-scoped-event-id.cpp.2.o']
I'am using g++ 4.7.2-5 :
test@ndn1:~/ndn-cxx-ndn-cxx-0.4.0$ g++ --version
g++ (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Here is my waf configure output :
test@ndn1:~/ndn-cxx-ndn-cxx-0.4.0$ ./waf configure
Setting top to : /home/test/ndn-cxx-ndn-cxx-0.4.0
Setting out to : /home/test/ndn-cxx-ndn-cxx-0.4.0/build
Building static library : no
Building shared library : yes
Checking for 'g++' (C++ compiler) : /usr/bin/g++
Checking supported CXXFLAGS : -std=c++11
Checking supported CXXFLAGS : -O2 -g -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
Checking for program 'doxygen' : /usr/bin/doxygen
Checking for program 'tar' : /bin/tar
Checking for program 'sphinx-build' : /usr/bin/sphinx-build
Checking for std::is_default_constructible : yes
Checking for std::is_nothrow_move_constructible : yes
Checking for std::is_nothrow_move_assignable : yes
Checking for friend typename-specifier : yes
Checking for override and final specifiers : yes
Checking for std::to_string : yes
Checking for std::vector::insert with const_iterator : no
Checking for program 'sh' : /bin/sh
Checking for library pthread : yes
Checking for library rt : yes
Checking for function getpass : yes
Checking for rtnetlink : yes
Checking for program 'pkg-config' : /usr/bin/pkg-config
Checking for 'sqlite3' : yes
Checking Crypto++ lib : 5.6.1
Checking if CryptoPP library works : yes
Checking boost includes : 1.49.0
Checking boost libs : ok
Checking for boost linkage : ok
'configure' finished successfully (2.758s)
Best Regards,
Updated by Alex Afanasyev almost 10 years ago
This looks to be related to gcc 4.7.2 bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56191).
Can you try to mark the destructor of ScopedEventId class as noexcept and try compile again?
diff --git a/src/util/scheduler-scoped-event-id.cpp b/src/util/scheduler-scoped-event-id.cpp
index 2858749..5dd5cbc 100644
--- a/src/util/scheduler-scoped-event-id.cpp
+++ b/src/util/scheduler-scoped-event-id.cpp
@@ -52,7 +52,7 @@ ScopedEventId::operator=(const EventId& event)
return *this;
}
-ScopedEventId::~ScopedEventId()
+ScopedEventId::~ScopedEventId() noexcept
{
m_scheduler->cancelEvent(m_event);
}
diff --git a/src/util/scheduler-scoped-event-id.hpp b/src/util/scheduler-scoped-event-id.hpp
index 1391d5d..823f60a 100644
--- a/src/util/scheduler-scoped-event-id.hpp
+++ b/src/util/scheduler-scoped-event-id.hpp
@@ -57,7 +57,7 @@ public:
/** \brief cancels the event
*/
- ~ScopedEventId();
+ ~ScopedEventId() noexcept;
/** \brief cancels the event manually
*/
Updated by Christophe Nowicki almost 10 years ago
Alex Afanasyev wrote:
Can you try to mark the destructor of ScopedEventId class as noexcept and try compile again?
Fixed! Thanks
Updated by Christophe Nowicki almost 10 years ago
I've got the same problem with :
../src/util/scheduler-scoped-event-id.cpp:29:1: error: static assertion failed: ScopedEventId must be MoveConstructible with noexcept
Updated by Alex Afanasyev almost 10 years ago
- Status changed from New to Code review
- Assignee set to Alex Afanasyev
- % Done changed from 0 to 100
Try this extended patch. Worked on my test installation of debian:
diff --git a/src/util/scheduler-scoped-event-id.cpp b/src/util/scheduler-scoped-event-id.cpp
index 2858749..7c307a8 100644
--- a/src/util/scheduler-scoped-event-id.cpp
+++ b/src/util/scheduler-scoped-event-id.cpp
@@ -52,7 +52,7 @@ ScopedEventId::operator=(const EventId& event)
return *this;
}
-ScopedEventId::~ScopedEventId()
+ScopedEventId::~ScopedEventId() noexcept
{
m_scheduler->cancelEvent(m_event);
}
@@ -64,7 +64,7 @@ ScopedEventId::cancel()
}
void
-ScopedEventId::release()
+ScopedEventId::release() noexcept
{
m_event.reset();
}
diff --git a/src/util/scheduler-scoped-event-id.hpp b/src/util/scheduler-scoped-event-id.hpp
index 1391d5d..c2192f5 100644
--- a/src/util/scheduler-scoped-event-id.hpp
+++ b/src/util/scheduler-scoped-event-id.hpp
@@ -57,7 +57,7 @@ public:
/** \brief cancels the event
*/
- ~ScopedEventId();
+ ~ScopedEventId() noexcept;
/** \brief cancels the event manually
*/
@@ -68,7 +68,7 @@ public:
* when this ScopedEventId is destructed
*/
void
- release();
+ release() noexcept;
private:
Scheduler* m_scheduler; // pointer to allow move semantics
diff --git a/src/util/signal-scoped-connection.cpp b/src/util/signal-scoped-connection.cpp
index 2ebbb08..64c5774 100644
--- a/src/util/signal-scoped-connection.cpp
+++ b/src/util/signal-scoped-connection.cpp
@@ -55,7 +55,7 @@ ScopedConnection::operator=(const Connection& connection)
return *this;
}
-ScopedConnection::~ScopedConnection()
+ScopedConnection::~ScopedConnection() noexcept
{
m_connection.disconnect();
}
diff --git a/src/util/signal-scoped-connection.hpp b/src/util/signal-scoped-connection.hpp
index a659844..2e93708 100644
--- a/src/util/signal-scoped-connection.hpp
+++ b/src/util/signal-scoped-connection.hpp
@@ -54,7 +54,7 @@ public:
/** \brief disconnects the connection
*/
- ~ScopedConnection();
+ ~ScopedConnection() noexcept;
/** \brief disconnects the connection manually
*/
Updated by Junxiao Shi almost 10 years ago
- Project changed from NFD to ndn-cxx
- Subject changed from ../src/util/scheduler-scoped-event-id.cpp:29:1: error: static assertion failed: ScopedEventId must be MoveConstructible with noexcept to scheduler-scoped-event-id.cpp error: static assertion failed: ScopedEventId must be MoveConstructible with noexcept
- Category changed from Build to Utils
- Target version changed from v0.4 to v0.5
Updated by Davide Pesavento almost 10 years ago
- Status changed from Code review to Closed