- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15.1k
 
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyconstevalC++20 constevalC++20 consteval
Description
https://godbolt.org/z/3o1G81ahn
#include <array>
#include <iostream>
#include <ranges>
#include <string>
using namespace std;
template <size_t N>
consteval auto make_static(const string& str) {
    array<char, N> arr;
    str.copy(arr.data(), arr.size());
    return arr;
}
consteval string foo() { return string("some dynamic data") + " 42\n"; }
int main() {
// WORKS:
//    constexpr auto xxx = make_static<foo().size()>(foo());
//    cout << (xxx | ranges::to<string>());
   cout << (make_static<foo().size()>(foo()) | ranges::to<string>());
    return 0;
}Clang fails to compile correct (I think yes :) program. GCC works. UB ?
TERESH1 and 3manifold
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyconstevalC++20 constevalC++20 consteval