From 6d1e3d8af4c25588c430fcddfeb2608747053614 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Sun, 7 Apr 2019 21:47:27 +0200 Subject: [PATCH] Try to reproduce GCC tester error with ambiguous constructor --- tests/algorithms/general_data_storage_01.cc | 23 +++++++++++++++++++ .../general_data_storage_01.debug.output | 1 + .../general_data_storage_01.debug.output.2 | 1 + .../general_data_storage_01.release.output | 1 + 4 files changed, 26 insertions(+) diff --git a/tests/algorithms/general_data_storage_01.cc b/tests/algorithms/general_data_storage_01.cc index fc421e7895..5721492f80 100644 --- a/tests/algorithms/general_data_storage_01.cc +++ b/tests/algorithms/general_data_storage_01.cc @@ -138,6 +138,29 @@ main() deallog << "Size: " << data.size() << std::endl; } + deallog << "Ambiguous construction" << std::endl; + { + // Pass Arguments by lvalue reference + { + const double val_1 = 1.0; + const double &val_2 = + data.get_or_add_object_with_name("value", val_1); + } + + // Pass Arguments by rvalue reference + { + double val_1 = 1.0; + const double &val_2 = + data.get_or_add_object_with_name("value", std::move(val_1)); + } + + // Pass Arguments ambiguously + { + const double &val_2 = + data.get_or_add_object_with_name("value", 1.0); + } + } + deal_II_exceptions::disable_abort_on_exception(); diff --git a/tests/algorithms/general_data_storage_01.debug.output b/tests/algorithms/general_data_storage_01.debug.output index 4583c5e216..0c9a8b99b9 100644 --- a/tests/algorithms/general_data_storage_01.debug.output +++ b/tests/algorithms/general_data_storage_01.debug.output @@ -17,6 +17,7 @@ DEAL::Data post-merge: DEAL::value double DEAL::value_2 double DEAL::Size: 2 +DEAL::Ambiguous construction DEAL::Try to overwrite existing entry: Copy DEAL:: -------------------------------------------------------- diff --git a/tests/algorithms/general_data_storage_01.debug.output.2 b/tests/algorithms/general_data_storage_01.debug.output.2 index 50b2af1bbd..f44444ad4e 100644 --- a/tests/algorithms/general_data_storage_01.debug.output.2 +++ b/tests/algorithms/general_data_storage_01.debug.output.2 @@ -17,6 +17,7 @@ DEAL::Data post-merge: DEAL::value double DEAL::value_2 double DEAL::Size: 2 +DEAL::Ambiguous construction DEAL::Try to overwrite existing entry: Copy DEAL:: -------------------------------------------------------- diff --git a/tests/algorithms/general_data_storage_01.release.output b/tests/algorithms/general_data_storage_01.release.output index b10d09135f..9384e0f746 100644 --- a/tests/algorithms/general_data_storage_01.release.output +++ b/tests/algorithms/general_data_storage_01.release.output @@ -17,6 +17,7 @@ DEAL::Data post-merge: DEAL::value double DEAL::value_2 double DEAL::Size: 2 +DEAL::Ambiguous construction DEAL::Try to overwrite existing entry: Copy DEAL::Try to overwrite existing entry: Reference DEAL::Fetch non-existing entry -- 2.39.5