https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92869
Bug ID: 92869
Summary: g++ wrongly reports aggregate type as not-aggregate
(when explicitly defaulted ctors are added)
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: igor.chorazewicz at intel dot com
Target Milestone: ---
The following code, when compiled with -std=c++17 results in "0" being printed.
The correct behavior is to print "1". Removing ctors fixes the issue, however,
accordingly to the standard, explicitly defaulted ctors are allowed for an
aggregate.
#include <array>
#include <type_traits>
#include <iostream>
template <typename T, std::size_t N>
struct A {
A() = default;
A(const A &) = default;
A(A &&) = default;
T arr[N];
};
int main()
{
std::cout << std::is_aggregate<A<int,3>>::value;
}