Language
C++
Compiler
clang 17.0.1
Options
Warnings
Don't Use Boost
C++2b
no pedantic
$ clang++ prog.cc -Wall -Wextra -std=c++2b
Exit Code:
1
Author
anonymous
over 1 year ago
C++
clang 17.0.1
Author
anonymous
over 1 year ago
$ clang++ prog.cc -Wall -Wextra -std=c++2b
prog.cc:19:25: error: constexpr variable 'str' must be initialized by a constant expression
19 | constexpr std::string str = "non transient constexpr allocation";
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cc:19:25: note: pointer to subobject of heap-allocated object is not a constant expression
/opt/wandbox/clang-17.0.1/include/c++/v1/__memory/allocator.h:112:38: note: heap allocation performed here
112 | return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
| ^
1 error generated.