Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation bug using Windows Visual Studio 2017 #12263

Closed
nicola-giuliani opened this issue May 20, 2021 · 7 comments
Closed

Compilation bug using Windows Visual Studio 2017 #12263

nicola-giuliani opened this issue May 20, 2021 · 7 comments

Comments

@nicola-giuliani
Copy link
Contributor

I have just installed the latest version of the library on a windows machine using Visual Studio 2017, MSVC 19.16.27034.0. The installation was smooth but I can't compile the test grid_tools_03. The problem lies in the volume function that has changed since release 9.2 (which was working fine).

The error is the following

grid_tools.h(185): error C2059: syntax error: 'template'

@bangerth
Copy link
Member

Oh :-( Can you test what happens with a patch such as this?

diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h
index 83b79d759d..b39e43f96b 100644
--- a/include/deal.II/grid/grid_tools.h
+++ b/include/deal.II/grid/grid_tools.h
@@ -184,7 +184,11 @@ namespace GridTools
   volume(const Triangulation<dim, spacedim> &tria,
          const Mapping<dim, spacedim> &      mapping =
            (ReferenceCells::get_hypercube<dim>()
-              .template get_default_linear_mapping<dim, spacedim>()));
+              .
+#ifndef _MSC_VER
+              template
+#endif
+            get_default_linear_mapping<dim, spacedim>()));
 
   /**
    * Return an approximation of the diameter of the smallest active cell of a

@bangerth
Copy link
Member

For reference, this is related to #11604.

@nicola-giuliani
Copy link
Contributor Author

With the patch since _MSC_VER is not defined the error changes
error 2039: 'dealii::get_default_linear_mapping': is not a member of 'dealii::ReferenceCell'

@nicola-giuliani
Copy link
Contributor Author

const dealii::Mapping<dim, spacedim>& mapping =
(dealii::ReferenceCells::get_hypercube().template get_default_linear_mapping<dim, spacedim>());
dealii::Triangulation<dim, spacedim> tria;
dealii::GridGenerator::hyper_cube(tria);
const double volume1 = dealii::GridTools::volume<dim, spacedim>(tria, mapping); //OK
const double volume2 = dealii::GridTools::volume<dim, spacedim>(tria); //ERROR

@nicola-giuliani
Copy link
Contributor Author

This is done with the original implementation of volume.

@marcfehling
Copy link
Member

@DaneilSun found a solution to the problem in #13593.

The patch just covers a small part of the library. I guess we need to adjust all other occurrences of .template get_default_linear_mapping accordingly.

@drwells
Copy link
Member

drwells commented Mar 25, 2023

This is now fixed - further changes are tracked in #13596.

@drwells drwells closed this as completed Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants