[Bug c++/89741] New: [Regression] static_assert fires when template not instantiated

tadeus.prastowo at unitn dot it gcc-bugzilla@gcc.gnu.org
Sat Mar 16 23:00:00 GMT 2019


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

            Bug ID: 89741
           Summary: [Regression] static_assert fires when template not
                    instantiated
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tadeus.prastowo at unitn dot it
  Target Milestone: ---

Consider the following MWE:
-- 8< ------------------------
template<typename T1, typename T2>
struct Y {
  static constexpr bool value = false;
};

template<>
struct Y<void, void> {
  static constexpr bool value = true;
};

template<int x>
struct X {
  static_assert(Y<void, decltype(x)>::value, "1");
};

int main() {
}
-- 8< ------------------------

Compiling it with GCC 8.3, GCC 7.4, GCC 6.3, GCC 5.5, GCC 4.9.4, Clang 6.0, and
Clang 7.0 gives no error (see https://www.godbolt.org/z/t8Dkw7).

Compiling it with GCC 9.0 (trunk) gives an error.


More information about the Gcc-bugs mailing list