From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4C46A385AC1D; Wed, 4 Aug 2021 06:20:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C46A385AC1D From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/44906] g++ is giving error: parse error in template argument list Date: Wed, 04 Aug 2021 06:20:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.4.3 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 06:20:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D44906 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |NEW Last reconfirmed|2011-09-23 00:00:00 |2021-8-3 --- Comment #11 from Andrew Pinski --- For the testcase in comment #8: Ok, this is interesting as at first I thought this was fixed in GCC 11 but = then I looked to see what the different standards do as GCC 11's default is C++1= 7. With C++17 and C++20, we get: :8:34: error: use of 'this' in a constant expression 8 | void add(void) { addVecVals<&vec1>(); } | ^~~~ : In instantiation of 'void MISC::add() [with T =3D int]': :13:10: required from here :8:39: error: no matching function for call to 'MISC::addVecVals<(&((MISC*)this)->MISC::vec1)>()' 8 | void add(void) { addVecVals<&vec1>(); } | ~~~~~~~~~~~~~~~~~^~ :7:26: note: candidate: 'template void MISC::addVecVals= () [with T* vc =3D vc; T =3D int]' 7 | template void addVecVals(){} | ^~~~~~~~~~ :7:26: note: template argument deduction/substitution failed: :8:34: error: '&((MISC*)this)->MISC::vec1' is not a valid template argument of type 'int*' because '((MISC*)this)->MISC::ve= c1' is not a variable 8 | void add(void) { addVecVals<&vec1>(); } | ^~~~ But for C++98, C++11, C++14, we get: : In member function 'void MISC::add()': :8:22: error: parse error in template argument list 8 | void add(void) { addVecVals<&vec1>(); } | ^~~~~~~~~~~~~~~~~=