[Bug c++/86641] New: Regression: non-ODR used auto class data members fail to deduce.

eric at efcs dot ca gcc-bugzilla@gcc.gnu.org
Mon Jul 23 09:31:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86641

            Bug ID: 86641
           Summary: Regression: non-ODR used auto class data members fail
                    to deduce.
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric at efcs dot ca
  Target Milestone: ---

In some situations, GCC will fail to resolve the storage size of auto variables
which are not not directly ODR used:

For example:
// std=c++17
struct MyT {
    constexpr MyT(long x) : value(x) {}
    long value;
};

namespace {
template <class T>
struct test_case {
  // error: storage size of '{anonymous}::test_case<MyT>::value' isn't known
  static constexpr auto value = T(100);
  static constexpr T use_value = value;
};
}

test_case<MyT> TC;

This only occurs in C++17 and newer. It seems to be a regression from GCC 8.x.
According to jwakely, this seems related to r260150.


More information about the Gcc-bugs mailing list