clang++ Questions

1

Solved

According to official documentation, Clang 13 supports C++20 Modules thru the use of a -fmodules command-line parameter. I cannot even get a basic module to compile using Clang 13 (macOS Monterey) ...
Municipality asked 30/11, 2021 at 10:58

2

Solved

This code is taken from IncludeOS github page. I modified it a bit so that it compiles without other header files. find function from IncludeOS is a bit too verbose, so I want to simplify it. But a...
Kozloski asked 25/11, 2017 at 13:56

1

I'm trying to rid my codebase of lossy implicit conversions, so I'm compiling with the -Wconversion flag under clang++. The following code is expected to output a warning, but does not. #include &...
Leonoreleonsis asked 11/4, 2019 at 19:40

1

Solved

In the past there have been concerns about using ASAN in production in certain environments: https://seclists.org/oss-sec/2016/q1/363 . The comment is from 2016 - what is the landscape like today? ...
Historian asked 17/11, 2021 at 11:33

1

Solved

Consider the following code, which mixes a member and a non-member operator| template <typename T> struct S { template <typename U> void operator|(U) {} }; template <typename T&g...
Avisavitaminosis asked 28/10, 2021 at 21:14

1

This code is from an answer to another question: template <typename F, std::size_t ... Is> constexpr auto apply(F f, std::index_sequence<Is...>) -> std::index_sequence<f(Is)...&gt...
Droshky asked 7/10, 2021 at 22:50

1

Solved

If I am using clang tools, what is the recommended way to get clang or some part of the clang toolchain to tell me that e.g. passing an int to a function that takes a short might be a bad idea? Giv...
Rains asked 12/10, 2021 at 23:20

0

Clang++ produces linker error if one calls immediate function returning void not from a context of another immediate function as in the example: consteval void f(int * x) { if(x) *x = 1; } cons...
Roble asked 10/10, 2021 at 9:34

2

Solved

Let's say I have a function like: template<typename It, typename Cmp> void mysort( It begin, It end, Cmp cmp ) { std::sort( begin, end, cmp ); } When I compile this using -finstrument-funct...
Nocuous asked 20/7, 2020 at 16:58

2

Solved

Consider the following C++17 code: #include <iostream> int read; int main(){ std::ios_base::sync_with_stdio(false); std::cin >> read; } It compiles and runs fine on Godbolt with GCC ...
Lilas asked 3/10, 2021 at 11:20

1

I've been Googling around for months trying to solve this, but nothing I've tried works. So a simple program like this: #include <concepts> #include <iostream> int main() { std::cout ...
Doorstep asked 2/9, 2021 at 23:8

1

Solved

Recent versions of clang (since clang-11) issue a warning when compiled with -pedantic for the following segment of code: namespace foo { template <int A> struct Bar { ~Bar(); }; } // nam...
Electioneer asked 12/8, 2021 at 4:37

1

I happen to find that GCC and Clang differ in the compilation of the following code: struct Foo { int mem = 42; }; int main() { constexpr Foo foo; static_assert(__builtin_constant_p(foo)); ret...
Yeaton asked 7/7, 2020 at 15:14

1

Solved

According to cppreference.com ( https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B20_features ) Clang has partial support of C++20 coroutines since version 8: But if in Clang trunk (which ...
Nolan asked 27/7, 2021 at 7:43

1

There is different behaviour in clang++ and g++ for the next program: #include <type_traits> #include <utility> template< std::size_t index, typename type > struct ref { type &a...
Georgiageorgian asked 21/12, 2016 at 12:16

3

Solved

I have the following script that attempts to print out all the AST nodes in a given C++ file. This works fine when using it on a simple file with trivial includes (header file in the same directory...
Palaestra asked 15/4, 2016 at 16:37

1

I have a simple C++ program that imports cmath. #include <cmath> int main() { return 0; } I'm trying to compile it using the following command. clang++ -o test main.cpp -std=c++14 But...
Rotorua asked 15/4, 2020 at 19:12

3

Solved

I have two applications, one compiled with gcc(c++) and another compiled with clang++. I am to use common shared boost library for both the applications. My question is whether to compile boost sha...
Piperine asked 8/4, 2018 at 7:20

2

Solved

For the following C++14 code, why does g++'s generated code for new A[1]{x} seem to invoke the copy constructor twice? #include <iostream> using namespace std; class A { public: A() { cout ...
Internode asked 15/5, 2021 at 3:47

3

Solved

I'm in the process of moving a project currently compiling with gcc to clang, and have a bunch of warnings that gcc didn't generate (-Winconsistent-missing-override). clang-tidy works for fixing th...
Sacrilegious asked 8/2, 2016 at 3:15

1

Solved

According to the blog post C++ Coroutines: Understanding Symmetric Transfer symmetric transfer allows you to suspend one coroutine and resume another without consuming any additional stack space. T...
Lenni asked 8/5, 2021 at 10:22

1

I've just installed clang++ and libc++ from https://github.com/llvm/llvm-project.git. While trying to run: clang main.cpp -stdlib=libc++ -lc++abi where main.cpp: #include <iostream> int ...
Wiegand asked 17/2, 2019 at 0:18

3

Solved

I am trying to fix some bugs in an open source C++ project and the original author is currently too busy with his academic life to help. The code compiles just fine with gcc-4.9 installed via macpo...
Pelkey asked 24/6, 2015 at 20:35

1

When compiling this simple program: (with clang++-11 -fmodules main.cpp -o main.o -std=c++2a) // main.cpp import "pch1.h"; int main() { std::cout << "Hello" << std...
Shock asked 11/3, 2021 at 7:8

3

I am in the process of converting my old code to something that is importable as c++-modules. The problem is that i would want it to still work and be easily maintained as the old header/source ver...
Crichton asked 17/2, 2021 at 10:17

© 2022 - 2024 — McMap. All rights reserved.