clang++ Questions
3
Solved
I am experimenting with modules in clang, and would like to include the standard lib as modules instead of as includes.
Currently I do this
#include <iostream>
#include <string>
It see...
Heteroecious asked 28/2, 2021 at 16:15
1
Solved
I'm trying to understand under what circumstances I can pass a type template as an argument for a template template parameter with a different signature. E.g., I would expect that the following mig...
Ulmaceous asked 24/4, 2021 at 2:50
1
What quick-fix can we use while <lambda>::operator<T>() explicit call is not fix yet ?
Reported issue on LLVM bug report : https://bugs.llvm.org/show_bug.cgi?id=49881
Considering the ...
1
Solved
Toying around with literal, non-type template parameters in c++20, I found out that g++ and clang++ disagree about the following code.
#include <algorithm>
template<size_t N>
struct St...
Creditable asked 21/3, 2021 at 10:41
1
Solved
According to Godbolt's Compiler Explorer (see demo), the following code compiles with GCC (both 10.2 and trunk) and outputs 3628800, but fails to compile with Clang (both 11.0.1 and trunk). In both...
Renie asked 13/3, 2021 at 18:35
1
Solved
When compiling c++-20 modules with clang. I get strange compilation errors when importing a file that imports another file that imports a third file like so:
// a.cppm
#include <string>
expo...
Gompers asked 28/2, 2021 at 17:14
1
I'd like to use the clang static analyzer command line tool scan-build with the convenience of cmake --build.
Most of the resources I found online seem to indicate you need a two-step process:
sc...
Dissimulate asked 22/2, 2017 at 14:1
3
Solved
In this question:
Print template typename at compile time
we have a few suggestions regarding how to get typical C++ compilers to print a type's name, at compile time. However, they rely on trigg...
Citizenry asked 13/2, 2020 at 8:58
1
Solved
2
Solved
I have a C++ project which I compile using ninja and clang++, and would like to have errors during compilation appear in the quickfix list. Currently, when I set makeprg=ninja, and then run :make, ...
1
In c++20, when enabling modules, each include is supposed to be encapsulated so that the ordering does not matter, and macros does not leak out etc.
Apparently the question if it is possible to pre...
Malaise asked 10/12, 2020 at 14:5
1
Solved
Consider the following structure with an std::optional containing a type that definitely has a "normal" default constructor.
#include <optional>
#include <string>
struct Foo
...
Unknown asked 27/8, 2020 at 20:52
2
I am trying to combine nested classes and forward declarations to keep the code legible even though it has a terribly complicated class structure. The forward declarations allow me to reduce the le...
Lingua asked 18/11, 2020 at 15:18
1
Solved
Can someone explain why both compilers throw an error on the second example whereas only gcc throws an error on the first example? Is it somehow related to the result of the static_cast being...
Radioisotope asked 18/11, 2020 at 11:53
1
Two months ago, I reported, as a clang++ bug, that the C++ program below sets z to 4294967295 when compiled with clang++ -O2 -fno-strict-enums.
enum e { e1, e2 } e;
long long x, y, z;
char *p;
v...
Woodwind asked 7/11, 2020 at 14:40
1
Solved
This is a followup for another question which is already resolved. But then, I receive this error:
error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
!std::is_same_v&...
1
Solved
When I use clang (10.0.1) to compile that:
#include <iostream>
template <typename ...Args>
void f( int a = 4, Args&&... aArgs )
{
std::cout << a << std::endl;
}
i...
2
Solved
I have a reasonably large project (4272 .o files) and I can't get it to link with GNU Make. I run into make: /bin/sh: Argument list too long. This is a Qt 5 project that uses qmake to generate the ...
1
Solved
In C++20 it is possible to instead of include headers with
#include "header.h"
use
#import "header.h" // Edit: this is not standard see comments
(this is for old code that can...
1
Solved
I'm playing with recently approved C++20 standard features std::construct_at() and trying to get more familiar with them...
I've built an example based on the example from CppReference.com:
#includ...
2
2
Solved
I want to use libc++ together with clang on Arch Linux in CMake project. I installed libc++ and added following lines to CMakeLists.txt as said on LLVM site in Linux section of "Using libc++ in you...
2
GodBolt
Consider the following code snippet:
using A = void(*)(int);
A foo(const void* ptr)
{
return reinterpret_cast<A>(ptr);
}
GCC 10 likes this just fine. clang++-10, however, says thi...
Bandwidth asked 17/7, 2020 at 20:15
1
Solved
Trying to compile the following code:
#include <functional>
void test() {
int a = 5;
std::function<void()> f = [a](){
[a]()mutable{ // isn't it capture 'a' by copy???
a = 13; // ...
Cornflower asked 9/7, 2020 at 15:43
2
Solved
This fails to compile with clang++, can anybody explain why ? (this compiles fine with g++)
struct X
{
template <typename T> X() {}
};
template X::X<int>();
int main() { return 1; }
...
© 2022 - 2024 — McMap. All rights reserved.