Skip to content

Conversation

doug-moen
Copy link

When compiling using gcc or clang, Volumes.h produced 8 compile errors like this:

./Volumes.h:134:10: error: explicit specialization of 'surface' in class scope
                double surface<Surface::Sphere>(const double x, const double y, const double z)
                       ^

The problem is that the C++ standard does not permit a template to be specialized in class scope, only in namespace scope, but Microsoft Visual C++ allows this as a language extension, and gcc/clang do not.
Reference: https://stackoverflow.com/questions/3052579/explicit-specialization-in-non-namespace-scope

The fix is to move the template specializations out of the Volumes::Surface class and define them in namespace scope.

@rogrosso
Copy link
Owner

rogrosso commented Aug 2, 2020 via email

@ChristopherFowler
Copy link

When compiling using gcc or clang, Volumes.h produced 8 compile errors like this:

./Volumes.h:134:10: error: explicit specialization of 'surface' in class scope
                double surface<Surface::Sphere>(const double x, const double y, const double z)
                       ^

The problem is that the C++ standard does not permit a template to be specialized in class scope, only in namespace scope, but Microsoft Visual C++ allows this as a language extension, and gcc/clang do not. Reference: https://stackoverflow.com/questions/3052579/explicit-specialization-in-non-namespace-scope

The fix is to move the template specializations out of the Volumes::Surface class and define them in namespace scope.

For what it is worth, I'm going to fix this issue and make it work because I would like to use your code.

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

Successfully merging this pull request may close these issues.

3 participants