question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

C++ compile error when using std::apply with clang 4.0.0.

See original GitHub issue

clang 4.0.0 has C++17 std::apply implementation. I confirmed that it works OK on my local LLVM 4.0.0 installation.

Following are test codes to reproduce the compile error. It fails with clang 4.0.0 and clang (trunk). But it succeeded with gcc 7.1 and gcc (snapshot).

Of course, I set -std=c++1z compiler option.

#include <tuple>

constexpr int add(int a, int b)
{
    return a + b;
}

static_assert(std::apply(&add, std::make_tuple(10, 20)) == 30);
screen shot 2017-05-26 at 3 22 22 pm

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mattgodboltcommented, May 26, 2017

Add the parameter -stdlib=libc++ to use clang’s library instead of the default GCC library. On Fri, May 26, 2017 at 1:24 AM, Gil Ho, Jang notifications@github.com wrote:

clang 4.0.0 has C++17 std::apply implementation. I confirmed that it works OK on my local LLVM 4.0.0 installation.

Following are test codes to reproduce the compile error. It fails with clang 4.0.0 and clang (trunk). But it succeeded with gcc 7.1 and gcc (snapshot).

Of course, I set -std=c++1z compiler option.

#include <tuple> constexpr int add(int a, int b) { return a + b; } static_assert(std::apply(&add, std::make_tuple(10, 20)) == 30);

[image: screen shot 2017-05-26 at 3 22 22 pm] https://cloud.githubusercontent.com/assets/13075164/26483314/56663fca-4227-11e7-817b-d3d0f7e4020a.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mattgodbolt/compiler-explorer/issues/440, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmsdV3Wo9nObNj1WX2HkWIxNcuJA-RMks5r9nAygaJpZM4NnODa .

0reactions
mattgodboltcommented, Jul 14, 2017

Oh wow! I thought I’d already updated them to do so! Will do that at least!!! Thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

C++ compile error when using std::apply with clang 4.0.0. #440
clang 4.0.0 has C++17 std::apply implementation. I confirmed that it works OK on my local LLVM 4.0.0 installation. Following are test codes ...
Read more >
Clang++ 4.0.0 compilation error in windows - Stack Overflow
On compilation I get the following error: C:\Sample>clang++ -emit-llvm -S assiral.cpp -o assiral.ll In file included from assiral.cpp:3 ...
Read more >
Clang Compiler User's Manual - LLVM releases
This document describes important notes about using Clang as a compiler for an end-user, documenting the supported features, command line options, etc.
Read more >
Clang linking error MacOS Big Sur | Apple Developer Forums
Hi All, I am trying to build my helloworld.cpp, but I am having problem since I updated to Big Sur. Below a verbose...
Read more >
1459393 – clang fails with -std=c++17 or - Red Hat Bugzilla
Description of problem: This small program fails to compile ... include/c++/7/mutex:672:4: error: no matching function for call to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found