view gcc/testsuite/g++.dg/cpp1y/pr91845.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// PR c++/91845 - ICE with invalid pointer-to-member.
// { dg-do compile { target c++14 } }

void non_const_mem_ptr() {
  struct A {
  };
  constexpr A a = {1, 2}; // { dg-error "too many initializers" }
  struct B {
    int A::*p;
    constexpr int g() const {
      return a.*p; // { dg-error "use of local variable" }
    };
  };
}