aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Poletti <poletti.marco@gmail.com>2018-09-01 14:57:36 +0100
committerMarco Poletti <poletti.marco@gmail.com>2018-09-01 14:57:36 +0100
commit5fbea5bbdfbcedcb36e025ded41df739951cff2b (patch)
treeed28996f29deb17b476d0c362701c874e0132bd8
parent7a0a16708cfd1786a6a5038315af2d205fb74194 (diff)
downloadgoogle-fruit-5fbea5bbdfbcedcb36e025ded41df739951cff2b.tar.gz
Another attempt at improving the error messages for componentFunction() misuse when using MSVC.
-rw-r--r--include/fruit/impl/component_function.defn.h2
-rwxr-xr-xtests/test_component_functions.py13
2 files changed, 11 insertions, 4 deletions
diff --git a/include/fruit/impl/component_function.defn.h b/include/fruit/impl/component_function.defn.h
index 51df7bb..efc6c5d 100644
--- a/include/fruit/impl/component_function.defn.h
+++ b/include/fruit/impl/component_function.defn.h
@@ -26,7 +26,7 @@ namespace fruit {
template <typename ComponentType, typename... ComponentFunctionArgs>
ComponentFunction<ComponentType, ComponentFunctionArgs...>::ComponentFunction(
ComponentType (*getComponent)(ComponentFunctionArgs...), ComponentFunctionArgs... args)
- : getComponent(getComponent), args_tuple(args...) {
+ : getComponent(getComponent), args_tuple{args...} {
using IntCollector = int[];
(void)IntCollector{0, fruit::impl::checkAcceptableComponentInstallArg<ComponentFunctionArgs>()...};
}
diff --git a/tests/test_component_functions.py b/tests/test_component_functions.py
index e9ebe27..69ab6cf 100755
--- a/tests/test_component_functions.py
+++ b/tests/test_component_functions.py
@@ -147,7 +147,8 @@ def test_component_function_error_not_move_constructible():
expect_generic_compile_error(
'error: use of deleted function .Arg::Arg\(Arg&&\).'
+ '|error: call to deleted constructor of .Arg.'
- + '|.Arg::Arg\(Arg &&\).: cannot convert argument 1 from .std::_Tuple_val<Arg>. to .const Arg &.',
+ + '|.Arg::Arg\(Arg &&\).: cannot convert argument 1 from .std::_Tuple_val<Arg>. to .const Arg &.'
+ + '|.Arg::Arg\(Arg &&\).: attempting to reference a deleted function',
COMMON_DEFINITIONS,
source)
@@ -222,7 +223,10 @@ def test_component_function_error_not_copy_constructible():
expect_generic_compile_error(
'error: use of deleted function .Arg::Arg\(const Arg&\).'
+ '|error: call to deleted constructor of .Arg.'
- + '|error C2280: .Arg::Arg\(const Arg &\).: attempting to reference a deleted function',
+ + '|error C2280: .Arg::Arg\(const Arg &\).: attempting to reference a deleted function'
+ # This is the error printed by MSVC. It's not great but I couldn't find a way to have it print
+ # a more useful error.
+ + '|cannot convert argument 1 from .int. to .std::allocator_arg_t.',
COMMON_DEFINITIONS,
source)
@@ -261,7 +265,10 @@ def test_component_function_error_not_copy_constructible_with_conversion():
expect_generic_compile_error(
'error: use of deleted function .Arg::Arg\(const Arg&\).'
+ '|error: call to deleted constructor of .Arg.'
- + '|error C2280: .Arg::Arg\(const Arg &\).: attempting to reference a deleted function',
+ + '|error C2280: .Arg::Arg\(const Arg &\).: attempting to reference a deleted function'
+ # This is the error printed by MSVC. It's not great but I couldn't find a way to have it print
+ # a more useful error.
+ + '|cannot convert argument 1 from .int. to .std::allocator_arg_t.',
COMMON_DEFINITIONS,
source)