Skip to content

Compilation of meshTools/searchableSurfaces/searchableSphere/searchableSphere.C needs "#include <array>" with clang 12.0.5 (macOS)

Summary

On OpenFOAM-v2012, ${FOAM_SRC}/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C requires that the "#include <array>" header is added to the top of the file when compiling with clang 12.0.5 (macOS 11.4, arm).

Steps to reproduce

Try compile OpenFOAM-v2012 on a case-sensitive partition on macOS 11.4 (arm) using Clang, Apple clang version 12.0.5 (clang-1205.0.22.9).

Example case

N/A

What is the current bug behaviour?

Compilation error.

What is the expected correct behavior?

It compiles :)

Relevant logs and/or images

N/A

Environment information

  • OpenFOAM version : v2012
  • Operating system : macOS 11.4 (arm)
  • Hardware info : Apple m1 arm CPU
  • Compiler : Apple clang version 12.0.5 (clang-1205.0.22.9), with target arm64-apple-darwin20.5.0

Possible fixes

Line 528 in searchableSphere.C causes the error:

std::array<uint8_t, 3> idx{0, 1, 2};

A quick fix is to add the array header at the top of the file:

#include "searchableSphere.H"
#include "addToRunTimeSelectionTable.H"
#include <array>