xsdk-project / xsdk-issues

A repository under which GitHub issues not related to a specific xSDK repo can be filed.
7 stars 0 forks source link

tasmanian build failure with clang1700 #229

Closed balay closed 9 months ago

balay commented 9 months ago

xr_l_c170-xsdk-100-linux-clang1700

https://gitlab.com/xsdk-project/spack-xsdk/-/jobs/5276299108

spack-build-out.txt

mkstoyanov commented 9 months ago

We narrowed now the problem to the way different compilers interpret the C++ standard.

The correct interpretation is not immediately obvious, older compilers have one behavior, newer ones act in a different way.

#include <iostream>
#include <memory>

struct B {
  virtual ~B() = default;
  virtual void foo() const = 0;
};

struct D : public B {
  void foo() const override {}
};

template<class T>
void bar(T) { std::cout << "bar(T)\n"; }

template<class T>
void bar(T const&) { std::cout << "bar(T const&)\n"; }

int main(int, char**)
{
    std::unique_ptr<B> p = std::make_unique<D>();
    // ok with gcc (all versions) and clang (versions <= 16)
    // ok with msvc (versions <= 19.24)
    // ambiguous call with msvc (>= 19.25) and clang 17
    bar(*p);

    return 0;
}
mkstoyanov commented 9 months ago

Added a patch to fix the problem

https://github.com/spack/spack/pull/40515

balay commented 9 months ago

Thanks! The build goes through now.

https://gitlab.com/xsdk-project/spack-xsdk/-/jobs/5291324290

mkstoyanov commented 9 months ago

Great! We can close the issue.