From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23526 invoked by alias); 4 Jun 2013 15:36:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 22897 invoked by uid 48); 4 Jun 2013 15:36:35 -0000 From: "plasmahh at gmx dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57526] New: use of X before deduction of auto error for seemingly good code Date: Tue, 04 Jun 2013 15:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: plasmahh at gmx dot net X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00180.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57526 Bug ID: 57526 Summary: use of X before deduction of auto error for seemingly good code Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: plasmahh at gmx dot net Hi, for the following code template struct A { void bar( ) { } void foo( ) { auto* this_ptr = this; auto lc = [&]( ) { this_ptr->bar(); }; lc(); } }; int main(int argc, const char *argv[]) { A a; a.foo(); } I get gcc 4.8.{0,1} error me out with: auto.cxx:12:4: error: use of 'A::foo() [with T = int]::__lambda0::__this_ptr' before deduction of 'auto' this_ptr->bar(); which for one was not the case with gcc 4.7. There are two (strange) ways to make it go away: Either make it be "auto" isntead of "auto*" or make A not being a template. I also could not find anything in the standard that would disallow this.