[flang-commits] [PATCH] D137859: [flang] Restore ENUM_CLASS() to be compilation-time code
Renaud Kauffmann via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Nov 11 15:42:40 PST 2022
Renaud-K added a comment.
Consider this program:
#include "enum_class.h"
#include <iostream>
ENUM_CLASS(RelationalOperator, LT, LE, EQ, NE, GE, GT)
int main() {
std::cout << EnumToString(RelationalOperator::LT) << std::endl;
std::cout << EnumToString(RelationalOperator::LE) << std::endl;
std::cout << EnumToString(RelationalOperator::EQ) << std::endl;
std::cout << EnumToString(RelationalOperator::NE) << std::endl;
std::cout << EnumToString(RelationalOperator::GE) << std::endl;
std::cout << EnumToString(RelationalOperator::GT) << std::endl;
return 0;
}
Then compile it gcc 9.3.0
g++ flang_main.cpp -std=c++17 -g -O2 -fno-inline
gdb a.out
b enum_class.h:43
r
Breakpoint 1, Fortran::common::EnumNames<6ul> (p=0x555555555648 "LT, LE, EQ, NE, GE, GT") at enum_class.h:43
43 for (; *p; ++p) {
Is this expected?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137859/new/
https://reviews.llvm.org/D137859
More information about the flang-commits
mailing list