From 5a71eb598585f0413ed630f5007f3c0295c7ba60 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 18 May 2016 14:03:03 +0200 Subject: [PATCH] Big 1213: add regression unit test. --- test/CMakeLists.txt | 2 ++ test/bug1213.cpp | 13 +++++++++++++ test/bug1213.h | 8 ++++++++ test/bug1213_main.cpp | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 test/bug1213.cpp create mode 100644 test/bug1213.h create mode 100644 test/bug1213_main.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3c0f9b685..9d49f1e97 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -259,6 +259,8 @@ ei_add_test(dense_storage) ei_add_test(ctorleak) ei_add_test(mpl2only) +add_executable(bug1213 bug1213.cpp bug1213_main.cpp) + check_cxx_compiler_flag("-ffast-math" COMPILER_SUPPORT_FASTMATH) if(COMPILER_SUPPORT_FASTMATH) set(EIGEN_FASTMATH_FLAGS "-ffast-math") diff --git a/test/bug1213.cpp b/test/bug1213.cpp new file mode 100644 index 000000000..581760c1a --- /dev/null +++ b/test/bug1213.cpp @@ -0,0 +1,13 @@ + +// This anonymous enum is essential to trigger the linking issue +enum { + Foo +}; + +#include "bug1213.h" + +bool bug1213_1(const Eigen::Vector3f& x) +{ + return bug1213_2(x); +} + diff --git a/test/bug1213.h b/test/bug1213.h new file mode 100644 index 000000000..040e5a470 --- /dev/null +++ b/test/bug1213.h @@ -0,0 +1,8 @@ + +#include + +template +bool bug1213_2(const Eigen::Matrix& x); + +bool bug1213_1(const Eigen::Vector3f& x); + diff --git a/test/bug1213_main.cpp b/test/bug1213_main.cpp new file mode 100644 index 000000000..4802c0003 --- /dev/null +++ b/test/bug1213_main.cpp @@ -0,0 +1,18 @@ + +// This is a regression unit regarding a weird linking issue with gcc. + +#include "bug1213.h" + +int main() +{ + return 0; +} + + +template +bool bug1213_2(const Eigen::Matrix& ) +{ + return true; +} + +template bool bug1213_2(const Eigen::Vector3f&);