From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32362 invoked by alias); 28 Mar 2013 11:05:33 -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 32317 invoked by uid 48); 28 Mar 2013 11:05:27 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56760] namespaces, templates and forwarding declarations. Date: Thu, 28 Mar 2013 11:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg02089.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56760 --- Comment #9 from Jonathan Wakely 2013-03-28 11:05:26 UTC --- (In reply to comment #8) > I read the section on name lookup changes at > http://gcc.gnu.org/gcc-4.7/porting_to.html > > but it talks about a different kind of problem. Consider that there the > compiler does error messages. But here at our problem the linker (!) does the > error. It's the same problem. You get a linker error because this line: func(containHolder, b); // COMMENT THIS OUT AND IT WORKS calls this function: template void func(const seco::contain &a, nam::binbuffer &b) { func(*a.wombat, b); } which then calls this function: template void func (const T &a, nam::binbuffer &b); which is not defined. So you get a linker error. You are expecting it to call this function: template void func(const seco::holder &a, nam::binbuffer &b) { func(*a.fun, b); } but it cannot, because that is not declared before it is used. This is the situation described in the name lookup changes. Your code is not valid C++, the compiler is correct.