From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11506 invoked by alias); 10 Oct 2002 19:51:38 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 11489 invoked from network); 10 Oct 2002 19:51:38 -0000 Received: from unknown (HELO mail-out1.apple.com) (17.254.0.52) by sources.redhat.com with SMTP; 10 Oct 2002 19:51:38 -0000 Received: from mailgate1.apple.com (A17-128-100-225.apple.com [17.128.100.225]) by mail-out1.apple.com (8.11.3/8.11.3) with ESMTP id g9AJpci21524 for ; Thu, 10 Oct 2002 12:51:38 -0700 (PDT) Received: from scv1.apple.com (scv1.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.2.5) with ESMTP id for ; Thu, 10 Oct 2002 12:51:28 -0700 Received: from isolde (isolde.apple.com [17.201.24.249]) by scv1.apple.com (8.11.3/8.11.3) with ESMTP id g9AJpbb07424 for ; Thu, 10 Oct 2002 12:51:37 -0700 (PDT) Date: Thu, 10 Oct 2002 13:50:00 -0000 Mime-Version: 1.0 (Apple Message framework v543) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: When to emit the vtable for a class template From: Matt Austern To: gcc@gcc.gnu.org Content-Transfer-Encoding: 7bit Message-Id: X-SW-Source: 2002-10/txt/msg00558.txt.bz2 I'm not sure whether the compiler is following what the ABI specification (http://www.codesourcery.com/cxx-abi/abi.html) says. Entirely possible that I'm misunderstanding what the ABI document is saying, of course. The question: if you've got a polymorphic class template, which translation units do you emit the vtable in? 5.2.3 says that you emit a vtable in the object file where you've got the definition of the key function, or in every object file if no key function exists. 5.2.3 may or may not apply to a class template, of course. 5.2.7 seems to say that you emit a vtable for a class template in every object file where the class template is instantiated, irrespective of key functions. What I'm not completely clear of is what exactly it means to say that a class template is instantiated. The most reasonable interpretation is that the ABI specification is using this language in the same sense of the C++ Standard, meaning that a class template is instantiated "if the class type is used in a context that requires a completely-defined object type or if the completeness of the class type affects the semantics of the program". Was that the intention of the ABI specification and of the implementation? --Matt