Bug 89267

Summary: [8 Regression] FAIL: g++.dg/cpp1z/constexpr-lambda8.C (test for excess errors)
Product: gcc Reporter: H.J. Lu <hjl.tools>
Component: c++Assignee: Jason Merrill <jason>
Status: RESOLVED FIXED    
Severity: normal CC: jakub, jason, webrown.cpp
Priority: P1    
Version: 8.2.1   
Target Milestone: 8.3   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2019-02-09 00:00:00

Description H.J. Lu 2019-02-09 12:54:49 UTC
r268714 gave:

spawn -ignore SIGHUP /export/gnu/import/git/gcc-test/bld/gcc/testsuite/g++/../../xg++ -B/export/gnu/import/git/gcc-test/bld/gcc/testsuite/g++/../../ /export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C -fno-diagnostics-show-caret -fdiagnostics-color=never -nostdinc++ -I/export/gnu/import/git/gcc-test/bld/i686-pc-linux-gnu/libstdc++-v3/include/i686-pc-linux-gnu -I/export/gnu/import/git/gcc-test/bld/i686-pc-linux-gnu/libstdc++-v3/include -I/export/gnu/import/git/gcc-test/src-8/libstdc++-v3/libsupc++ -I/export/gnu/import/git/gcc-test/src-8/libstdc++-v3/include/backward -I/export/gnu/import/git/gcc-test/src-8/libstdc++-v3/testsuite/util -fmessage-length=0 -std=c++17 -S -o constexpr-lambda8.s^M
/export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C:11:27: error: non-constant condition for static assertion^M
/export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C:11:19:   in 'constexpr' expansion of 'Fwd.<lambda(int (*)(int), auto:1)>(NC.<lambda(auto:3)>::operator int (*)(int)<int>(), 3)'^M
/export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C:9:48: error: call to non-'constexpr' function '<lambda(auto:3)> [with auto:3 = int]'^M
/export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C:9:20: note: '<lambda(auto:3)> [with auto:3 = int]' is not usable as a 'constexpr' function because:^M
/export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C:9:35: error: 's' declared 'static' in 'constexpr' context^M
compiler exited with status 1
PASS: g++.dg/cpp1z/constexpr-lambda8.C    (test for errors, line 9)
PASS: g++.dg/cpp1z/constexpr-lambda8.C    (test for warnings, line 11)
PASS: g++.dg/cpp1z/constexpr-lambda8.C    (test for errors, line 11)
FAIL: g++.dg/cpp1z/constexpr-lambda8.C   (test for excess errors)
Excess errors:
/export/gnu/import/git/gcc-test/src-8/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C:9:48: error: call to non-'constexpr' function '<lambda(auto:3)> [with auto:3 = int]'
Comment 1 Jakub Jelinek 2019-02-09 13:12:54 UTC
This changed with r268700, the same set of errors/notes is emitted before and after, but
error: call to non-‘constexpr’ function ‘<lambda(auto:3)> [with auto:3 = int]’
used to be emitted on line 11 and now is emitted on line 9 instead.  Note, trunk emits it on line 11.
Do we want to adjust the testcase, or change something in the compiler?
Comment 2 Jakub Jelinek 2019-02-09 17:56:16 UTC
The trunk has unlike 8.x the first hunk from r268377 which handles CALL_FROM_THUNK_P elsewhere, and that is where it clears EXPR_LOCATION on the call too.
Comment 3 Jason Merrill 2019-02-11 17:58:15 UTC
Author: jason
Date: Mon Feb 11 17:57:41 2019
New Revision: 268776

URL: https://gcc.gnu.org/viewcvs?rev=268776&root=gcc&view=rev
Log:
	PR c++/89267 - change of error location.

	* pt.c (tsubst_copy_and_build): Do still clear expr location
	for instantiated thunk calls.

Modified:
    branches/gcc-8-branch/gcc/cp/ChangeLog
    branches/gcc-8-branch/gcc/cp/pt.c
Comment 4 Jason Merrill 2019-02-11 18:22:02 UTC
Fixed.