Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Many years later, in c++14, I think it is compilable now. (coliru.stacked-crooked.com/a/e84489e166f931b7) or do I misunderstand something? Is it undefined behavior? Commented Sep 5, 2017 at 4:51
  • c++14 relaxed rules for constexpr, but this question is about C++11 Commented Sep 5, 2017 at 7:45
  • True, the answers and pretext apply to c++11, but even today, this is the first result when searching for "c++ constexpr unroll for". Future searcher, please note that modern c++ does allow a for loop within a constexpr function/constructor. en.cppreference.com/w/cpp/language/constexpr Commented Oct 26, 2020 at 2:37