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
796beaad
Commit
796beaad
authored
Nov 19, 2016
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix collision with global convert function (#425)
parent
def68746
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
fmt/format.h
fmt/format.h
+3
-1
test/format-test.cc
test/format-test.cc
+8
-0
No files found.
fmt/format.h
View file @
796beaad
...
@@ -1155,7 +1155,9 @@ struct ConvertToIntImpl2<T, true> {
...
@@ -1155,7 +1155,9 @@ struct ConvertToIntImpl2<T, true> {
template
<
typename
T
>
template
<
typename
T
>
struct
ConvertToInt
{
struct
ConvertToInt
{
enum
{
enable_conversion
=
sizeof
(
convert
(
get
<
T
>
()))
==
sizeof
(
Yes
)
};
enum
{
enable_conversion
=
sizeof
(
fmt
::
internal
::
convert
(
get
<
T
>
()))
==
sizeof
(
Yes
)
};
enum
{
value
=
ConvertToIntImpl2
<
T
,
enable_conversion
>::
value
};
enum
{
value
=
ConvertToIntImpl2
<
T
,
enable_conversion
>::
value
};
};
};
...
...
test/format-test.cc
View file @
796beaad
...
@@ -1653,3 +1653,11 @@ FMT_VARIADIC(void, custom_format, const char *)
...
@@ -1653,3 +1653,11 @@ FMT_VARIADIC(void, custom_format, const char *)
TEST
(
FormatTest
,
CustomArgFormatter
)
{
TEST
(
FormatTest
,
CustomArgFormatter
)
{
custom_format
(
"{}"
,
42
);
custom_format
(
"{}"
,
42
);
}
}
void
convert
(
int
);
// Check if there is no collision with convert function in the global namespace.
TEST
(
FormatTest
,
ConvertCollision
)
{
fmt
::
format
(
"{}"
,
42
);
}
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