https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91122
Bug ID: 91122
Summary: alignas gives up evaluating a constant expression in
template context
Product: gcc
Version: 9.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bruno.manga95 at gmail dot com
Target Milestone: ---
The following code:
template <class T>
constexpr T min( const T& a, const T& b)
{
return a < b ? a : b;
}
template <class T, unsigned long N>
constexpr unsigned long alignment()
{
return min(sizeof(T), N);
}
template <class T, unsigned long N>
struct alignas(alignment<T, N>()) foo {};
int main()
{
foo<int, 4> f;
}
fails to compile on gc 9.1, but worked on previous releases and works again on
trunk: https://gcc.godbolt.org/z/0dSqva
I'm just wondering if the fix will be backported to gcc 9.2