Message ID | 20230310031351.2404945-1-jason@redhat.com |
---|---|
State | New |
Headers | show |
Series | [pushed] c++: overloaded fn in contract [PR108542] | expand |
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 27a79829737..d37e9d4d576 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -8728,6 +8728,8 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t complain) complain &= ~tf_ptrmem_ok; + STRIP_ANY_LOCATION_WRAPPER (rhs); + if (lhstype == unknown_type_node) { if (complain & tf_error) diff --git a/gcc/testsuite/g++.dg/contracts/contracts-err1.C b/gcc/testsuite/g++.dg/contracts/contracts-err1.C new file mode 100644 index 00000000000..8437d94e2ad --- /dev/null +++ b/gcc/testsuite/g++.dg/contracts/contracts-err1.C @@ -0,0 +1,7 @@ +// PR c++/108542 +// { dg-additional-options -fcontracts } +// { dg-do compile { target c++11 } } + +template<typename T> +void f (T n) {} +void g() [[pre: f]]; // { dg-error "overloaded" }