https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70819
Bug ID: 70819 Summary: constexpr error location wrong Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nathan at gcc dot gnu.org Target Milestone: --- Created attachment 38345 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38345&action=edit testcase Invoked as: nathan@morden:28>./cc1plus -fpreprocessed cexpr-error.ii we get: constexpr int fn6(const int&, int) constexpr int fn7(const int*, int) cexpr-error.ii: At global scope: cexpr-error.ii:17:24: in constexpr expansion of 'fn7(0u, 0)' cexpr-error.ii:14:14: in constexpr expansion of 'fn6((* a), b)' cexpr-error.ii:7:7: error: 'a' is not a constant expression b = a; ^ cexpr-error.ii:18:24: in constexpr expansion of 'fn7(0u, 8)' cexpr-error.ii:14:14: in constexpr expansion of 'fn6((* a), b)' cexpr-error.ii:6:13: in constexpr expansion of 'fn6(a, 0)' cexpr-error.ii:18:43: error: 'a' is not a constant expression constexpr int n4 = fn7 ((const int *) 0, 8); The first error is correctly located at tha 'b = a;' location. The second instance is not, and shows the original call site. inside constexpr.c the first error is from an evaluation of the original function body. the second is from a cloned copy via the recursive call. Something about cloning is throwing off the error location.