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

[SR-15229] static_assert failure when using cxx interop + Foundation + libstcd++ 10 on Ubuntu #3202

Open
swift-ci opened this issue Sep 22, 2021 · 1 comment

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-15229
Radar rdar://problem/83411414
Original Reporter natinusala (JIRA User)
Type Bug
Environment
  • Ubuntu 20.04

  • Swift 5.5 (september 20th-something release) official build

  • stdlib installed with libstdc++-10-dev

Additional Detail from JIRA
Votes 0
Component/s Compiler, Foundation
Labels Bug
Assignee None
Priority Medium

md5: 4e189258882818903efee073a7ab5c2c

Issue Description:

When building any file that has :

  • a integer comparison

  • Foundation imported

With `-Xswiftc -enable-experimental-cxx-interop` on an Ubuntu system that has libstdc++ 10, the following error appears :

/usr/include/c++/10/ext/numeric_traits.h:64:7: error: static_assert failed due to requirement '__is_integer_nonstrict<float>::__value' "invalid specialization"
      static_assert(__is_integer_nonstrict<_Value>::__value,
      ^
/usr/include/c++/10/ext/numeric_traits.h:61:12: note: in instantiation of template class '__gnu_cxx::__numeric_traits_integer<float>' requested here
    struct __numeric_traits_integer
           ^
/usr/include/c++/10/ext/numeric_traits.h:64:7: error: static_assert failed due to requirement '__is_integer_nonstrict<double>::__value' "invalid specialization"
      static_assert(__is_integer_nonstrict<_Value>::__value,
      ^
/usr/include/c++/10/ext/numeric_traits.h:61:12: note: in instantiation of template class '__gnu_cxx::__numeric_traits_integer<double>' requested here
    struct __numeric_traits_integer
           ^
/usr/include/c++/10/ext/numeric_traits.h:64:7: error: static_assert failed due to requirement '__is_integer_nonstrict<long double>::__value' "invalid specialization"
      static_assert(__is_integer_nonstrict<_Value>::__value,
      ^
/usr/include/c++/10/ext/numeric_traits.h:61:12: note: in instantiation of template class '__gnu_cxx::__numeric_traits_integer<long double>' requested here
    struct __numeric_traits_integer
           ^

If you remove either the Foundation import or the integer comparison, the error goes away. It also goes away if you try to build without the experimental CXX interop feature. Removing libstdc++ 10 is a workaround to the issue, since Swift now seems to use libstc++ 9 instead. or so I thought

Example program (in main.swift of a freshly made executable package) :

import Foundation
print("Hello, world!")
let foobar = 50
if foobar == 50 { print("50") }

Build with :

swift build -Xswiftc -enable-experimental-cxx-interop -c release -v
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants