-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"miscompilationneeds-reductionLarge reproducer that should be reduced into a simpler formLarge reproducer that should be reduced into a simpler form
Description
https://godbolt.org/z/z4szqa4rT
#include <iostream>
#include <string>
using namespace std;
namespace {
template <class T>
consteval const char* type2str() = delete;
template <>
consteval const char* type2str<int>() {
return "int";
};
template <typename T, const char* Name>
consteval const char* fun() {
static constexpr auto mmm = string(type2str<T>()) + " " + Name + "\x00";
return mmm.data();
}
} // namespace
int main() {
static constexpr char ZZZ[]{"qwe"}; // changing constexpr => const makes clang fail to compile (gcc eats both cases normally)
cout << fun<int, ZZZ>();
return 0;
}TERESH1, morgonf and socketpair
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"miscompilationneeds-reductionLarge reproducer that should be reduced into a simpler formLarge reproducer that should be reduced into a simpler form