Issue 126228
Summary Clang still fails to compile correct program with consteval in LLVM 19.1.7
Labels
Assignees
Reporter 3manifold
    Is it supposed that the issue https://github.com/llvm/llvm-project/issues/105558 was fixed in LLVM 19.1.7? I tried to compile the example in the aforementioned link under `Ubuntu 25.04 (Plucky Puffin)` and still fails. 

## clang
```
> clang++ --version
Ubuntu clang version 19.1.7 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
```
```
> clang++ -Wall -std=c++23 playground_main.cpp   -o test && ./test
playground_main.cpp:24:40: error: call to consteval function 'foo' is not a constant _expression_
   24 | cout << (make_static<foo().size()>(foo()) | ranges::to<string>());
      | ^
playground_main.cpp:24:40: note: pointer to subobject of heap-allocated object is not a constant _expression_
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/allocator.h:193:31: note: heap allocation performed here
  193 |             return static_cast<_Tp*>(::operator new(__n));
      | ^
1 error generated.
```

## gcc
```
> g++ -Wall -std=c++23 playground_main.cpp   -o test && ./test
some dynamic data 42
```

## System specs
```
> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=25.04
DISTRIB_CODENAME=plucky
DISTRIB_DESCRIPTION="Ubuntu Plucky Puffin (development branch)"
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to