Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
d4d51460
Unverified
Commit
d4d51460
authored
Mar 26, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/noexcept_exceptions' into develop
parents
a58ed3cd
33361943
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
README.md
README.md
+1
-1
json.hpp
src/json.hpp
+0
-0
json.hpp.re2c
src/json.hpp.re2c
+0
-0
unit-noexcept.cpp
test/src/unit-noexcept.cpp
+18
-0
No files found.
README.md
View file @
d4d51460
...
@@ -894,7 +894,7 @@ $ make json_unit -Ctest
...
@@ -894,7 +894,7 @@ $ make json_unit -Ctest
$ ./test/json_unit "
*
"
$ ./test/json_unit "
*
"
===============================================================================
===============================================================================
All tests passed (1120
2597 assertions in 47
test cases)
All tests passed (1120
3022 assertions in 48
test cases)
```
```
Alternatively, you can use [CMake](https://cmake.org) and run
Alternatively, you can use [CMake](https://cmake.org) and run
...
...
src/json.hpp
View file @
d4d51460
This diff is collapsed.
Click to expand it.
src/json.hpp.re2c
View file @
d4d51460
This diff is collapsed.
Click to expand it.
test/src/unit-noexcept.cpp
View file @
d4d51460
...
@@ -57,3 +57,21 @@ static_assert(noexcept(json(pod{})), "");
...
@@ -57,3 +57,21 @@ static_assert(noexcept(json(pod{})), "");
static_assert
(
noexcept
(
j
.
get
<
pod
>
()),
""
);
static_assert
(
noexcept
(
j
.
get
<
pod
>
()),
""
);
static_assert
(
not
noexcept
(
j
.
get
<
pod_bis
>
()),
""
);
static_assert
(
not
noexcept
(
j
.
get
<
pod_bis
>
()),
""
);
static_assert
(
noexcept
(
json
(
pod
{})),
""
);
static_assert
(
noexcept
(
json
(
pod
{})),
""
);
TEST_CASE
(
"runtime checks"
)
{
SECTION
(
"nothrow-copy-constructible exceptions"
)
{
// for ERR60-CPP (https://github.com/nlohmann/json/issues/531):
// Exceptions should be nothrow-copy-constructible. However, compilers
// treat std::runtime_exception differently in this regard. Therefore,
// we can only demand nothrow-copy-constructibility for our exceptions
// if std::runtime_exception is.
CHECK
(
std
::
is_nothrow_copy_constructible
<
json
::
exception
>::
value
==
std
::
is_nothrow_copy_constructible
<
std
::
runtime_error
>::
value
);
CHECK
(
std
::
is_nothrow_copy_constructible
<
json
::
parse_error
>::
value
==
std
::
is_nothrow_copy_constructible
<
std
::
runtime_error
>::
value
);
CHECK
(
std
::
is_nothrow_copy_constructible
<
json
::
invalid_iterator
>::
value
==
std
::
is_nothrow_copy_constructible
<
std
::
runtime_error
>::
value
);
CHECK
(
std
::
is_nothrow_copy_constructible
<
json
::
type_error
>::
value
==
std
::
is_nothrow_copy_constructible
<
std
::
runtime_error
>::
value
);
CHECK
(
std
::
is_nothrow_copy_constructible
<
json
::
out_of_range
>::
value
==
std
::
is_nothrow_copy_constructible
<
std
::
runtime_error
>::
value
);
CHECK
(
std
::
is_nothrow_copy_constructible
<
json
::
other_error
>::
value
==
std
::
is_nothrow_copy_constructible
<
std
::
runtime_error
>::
value
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment