From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id AE7D5394FC26 for ; Tue, 8 Jun 2021 11:45:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE7D5394FC26 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-mMTyuBGwPZiu-Y3u8cXdkw-1; Tue, 08 Jun 2021 07:45:42 -0400 X-MC-Unique: mMTyuBGwPZiu-Y3u8cXdkw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFA221020C2E; Tue, 8 Jun 2021 11:45:40 +0000 (UTC) Received: from localhost (unknown [10.33.37.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8755A5D6D3; Tue, 8 Jun 2021 11:45:40 +0000 (UTC) Date: Tue, 8 Jun 2021 12:45:39 +0100 From: Jonathan Wakely To: paulkoning@comcast.net Cc: gcc@gcc.gnu.org, Paul Smith Subject: Re: GCC 10.2: undefined reference to vtable: missing its key function Message-ID: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2021 11:45:45 -0000 (This should have been on the gcc-help list.) > I may be remembering wrong, but -- doesn't dynamic_cast look for a vtable? It uses a vtable if one is present, it can't cause one to be introduced, so ... >So if you do a dynamic cast mentioning that class you'd get such a reference. No. > Or is that an error when applied to a non-polymorphic class? You can use dynamic_cast to upcast (i.e. from derived to base) for non-polymorphic class types. It is an error to downcast (from base to derived) for a non-polymorphic class type.