Skip to content

Clang: error: non-type template argument is not a constant expression #6

Description

@Schamschula

While attempting to build py-gmic 3.6.3.post1 I see the following error:

[5/19] Building CXX object CMakeFiles/gmic-py.dir/src/nb_ndarray_buffer.cpp.o
FAILED: [code=1] CMakeFiles/gmic-py.dir/src/nb_ndarray_buffer.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/clang++ -DDEBUG=0 -DGMICPY_VERSION=3.6.3.post1 -DPy_LIMITED_API=0x030C0000 -Dcimg_display=1 -Dcimg_use_curl -Dcimg_use_fftw3 -Dcimg_use_jpeg -Dcimg_use_magick -Dcimg_use_openexr -Dcimg_use_png -Dcimg_use_tiff -Dcimg_use_zlib -Dgmic_py_EXPORTS -I/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/lib/cimg -I/opt/local/Library/Frameworks/Python.framework/Versions/3.13/include/python3.13 -I/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/nanobind/include -isystem /opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/lib/gmic/src -isystem /opt/local/include -isystem /opt/local/include/GraphicsMagick -isystem /opt/local/include/OpenEXR -isystem /opt/local/include/Imath -Os -stdlib=libc++ -arch arm64 -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -O3 -DNDEBUG -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -mmacosx-version-min=15.0 -fPIC -fvisibility=hidden -fno-stack-protector -Os -MD -MT CMakeFiles/gmic-py.dir/src/nb_ndarray_buffer.cpp.o -MF CMakeFiles/gmic-py.dir/src/nb_ndarray_buffer.cpp.o.d -o CMakeFiles/gmic-py.dir/src/nb_ndarray_buffer.cpp.o -c /opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/nb_ndarray_buffer.cpp
/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/nb_ndarray_buffer.cpp:91:5: error: non-type template argument is not a constant expression
   91 |     LOG_TRACE("Freeing buffer view");
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/logging.hpp:148:24: note: expanded from macro 'LOG_TRACE'
  148 | #define LOG_TRACE(...) LOG_(Level::Trace __VA_OPT__(, __VA_ARGS__))
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/logging.hpp:139:49: note: expanded from macro 'LOG_'
  139 |         static constexpr function_name_stripped<strlen(                     \
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  140 |             source_location::current().function_name())>                    \
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/nb_ndarray_buffer.cpp:91:5: note: non-constexpr function 'strlen' cannot be used in a constant expression
/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/logging.hpp:148:24: note: expanded from macro 'LOG_TRACE'
  148 | #define LOG_TRACE(...) LOG_(Level::Trace __VA_OPT__(, __VA_ARGS__))
      |                        ^
/opt/local/var/macports/build/py313-gmic-a2cba696/work/gmic-3.6.3.post1/src/logging.hpp:139:49: note: expanded from macro 'LOG_'
  139 |         static constexpr function_name_stripped<strlen(                     \
      |                                                 ^
1 error generated.

I get similar errors for nb_ndarray.cpp, gmicpy.cpp, and gmic_list_py.cpp.

I'm building under MacPorts with
Python 3.13
and
macOS 15.7.4 24G517 arm64
Xcode 26.2 17C52
clang version 15.0.7

Note: Apple llvm/clang versions do not track upstream llvm versions.
Compare llvm/llvm-project#104850

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions