mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 08:46:53 +08:00
Merge pull request #626 from CTerasa-ep/fix-warnings
Fix several `noexcept` and `possibly dangling reference` warnings
This commit is contained in:
commit
f904cd5447
@ -31,7 +31,7 @@ namespace chaiscript {
|
||||
/// structure which holds the internal state of a Boxed_Value
|
||||
/// \todo Get rid of Any and merge it with this, reducing an allocation in the process
|
||||
struct Data {
|
||||
Data(const Type_Info &ti, chaiscript::detail::Any to, bool is_ref, const void *t_void_ptr, bool t_return_value)
|
||||
Data(const Type_Info &ti, chaiscript::detail::Any to, bool is_ref, const void *t_void_ptr, bool t_return_value) noexcept
|
||||
: m_type_info(ti)
|
||||
, m_obj(std::move(to))
|
||||
, m_data_ptr(ti.is_const() ? nullptr : const_cast<void *>(t_void_ptr))
|
||||
|
||||
@ -501,13 +501,7 @@ namespace chaiscript {
|
||||
}
|
||||
|
||||
Boxed_Value eval_internal(const chaiscript::detail::Dispatch_State &t_ss) const override {
|
||||
const std::string &idname = [&]() -> const std::string & {
|
||||
if (this->children[0]->identifier == AST_Node_Type::Reference) {
|
||||
return this->children[0]->children[0]->text;
|
||||
} else {
|
||||
return this->children[0]->text;
|
||||
}
|
||||
}();
|
||||
const std::string &idname = (this->children[0]->identifier == AST_Node_Type::Reference) ? this->children[0]->children[0]->text : this->children[0]->text;
|
||||
|
||||
return t_ss->add_global_no_throw(Boxed_Value(), idname);
|
||||
}
|
||||
|
||||
@ -5,30 +5,30 @@
|
||||
|
||||
class TestBaseType {
|
||||
public:
|
||||
TestBaseType()
|
||||
TestBaseType() noexcept
|
||||
: val(10)
|
||||
, const_val(15)
|
||||
, mdarray{} {
|
||||
}
|
||||
TestBaseType(int)
|
||||
TestBaseType(int) noexcept
|
||||
: val(10)
|
||||
, const_val(15)
|
||||
, mdarray{} {
|
||||
}
|
||||
TestBaseType(int *)
|
||||
TestBaseType(int *) noexcept
|
||||
: val(10)
|
||||
, const_val(15)
|
||||
, mdarray{} {
|
||||
}
|
||||
|
||||
TestBaseType(const TestBaseType &other)
|
||||
TestBaseType(const TestBaseType &other) noexcept
|
||||
: val(other.val)
|
||||
, const_val(other.const_val)
|
||||
, const_val_ptr(&const_val)
|
||||
, func_member(other.func_member) {
|
||||
}
|
||||
|
||||
TestBaseType(TestBaseType &&other)
|
||||
TestBaseType(TestBaseType &&other) noexcept
|
||||
: val(other.val)
|
||||
, const_val(other.const_val)
|
||||
, const_val_ptr(&const_val)
|
||||
@ -59,7 +59,7 @@ public:
|
||||
|
||||
class Type2 {
|
||||
public:
|
||||
Type2(TestBaseType t_bt)
|
||||
Type2(TestBaseType t_bt) noexcept
|
||||
: m_bt(std::move(t_bt))
|
||||
, m_str("Hello World") {
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user