Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
699fe8e7
Commit
699fe8e7
authored
Jul 14, 2019
by
Jack Andersen
Committed by
Victor Zverovich
Jul 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove const qualification in compile-time checks
parent
da2d33f1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
include/fmt/core.h
include/fmt/core.h
+3
-1
test/format-test.cc
test/format-test.cc
+8
-0
No files found.
include/fmt/core.h
View file @
699fe8e7
...
...
@@ -198,6 +198,8 @@ using conditional_t = typename std::conditional<B, T, F>::type;
template
<
bool
B
>
using
bool_constant
=
std
::
integral_constant
<
bool
,
B
>
;
template
<
typename
T
>
using
remove_reference_t
=
typename
std
::
remove_reference
<
T
>::
type
;
template
<
typename
T
>
using
remove_const_t
=
typename
std
::
remove_const
<
T
>::
type
;
struct
monostate
{};
...
...
@@ -1273,7 +1275,7 @@ make_args_checked(const S& format_str,
static_assert
(
all_true
<
(
!
std
::
is_base_of
<
view
,
remove_reference_t
<
Args
>>
()
||
!
std
::
is_reference
<
Args
>
())...
>::
value
,
"passing views as lvalues is disallowed"
);
check_format_string
<
remove_
reference_t
<
Args
>
...
>
(
format_str
);
check_format_string
<
remove_
const_t
<
remove_reference_t
<
Args
>
>
...
>
(
format_str
);
return
{
args
...};
}
...
...
test/format-test.cc
View file @
699fe8e7
...
...
@@ -1854,6 +1854,14 @@ TEST(FormatTest, CompileTimeString) {
EXPECT_EQ
(
"foo"
,
fmt
::
format
(
FMT_STRING
(
"{}"
),
string_like
()));
}
TEST
(
FormatTest
,
CustomFormatCompileTimeString
)
{
EXPECT_EQ
(
"42"
,
fmt
::
format
(
FMT_STRING
(
"{}"
),
Answer
()));
Answer
answer
;
EXPECT_EQ
(
"42"
,
fmt
::
format
(
FMT_STRING
(
"{}"
),
answer
));
const
Answer
const_answer
;
EXPECT_EQ
(
"42"
,
fmt
::
format
(
FMT_STRING
(
"{}"
),
const_answer
));
}
#if FMT_USE_USER_DEFINED_LITERALS
// Passing user-defined literals directly to EXPECT_EQ causes problems
// with macro argument stringification (#) on some versions of GCC.
...
...
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