From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 1A3463857828 for ; Wed, 6 Jan 2021 20:51:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1A3463857828 Received: by mail-ed1-x52b.google.com with SMTP id g24so5622009edw.9 for ; Wed, 06 Jan 2021 12:51:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZiN4BZMPZ4nPsyBPtygBSanB6fvMHhqzus3hntzNrUI=; b=q+J1jtFOKJxYM761QFkkwpoi9a7hV2xa5wCQUgo8NTDKXEEV/fqLSx8JyHjKPsNV/A X5JU4xcAnGpJUtBCy+Xu2xhjSby03U7teiVR4FGL+uW8zxq+ObBfgCx+GueMljkIOWmN ZiCGYt3k4+1m07WegPA8CsOSNRjO6MIb9GRrxlW6PKPDugZfvqdtDSW3jWBcLblZk9Oe qMaIBv44bDSQPkxk9nkAKHFekw1mWQ9sM7iRcOZbPCp1+OQhh7k9smmbMig8OVK0CFBs J3R4anmnCocp71xtWSfMlQ9RFK3s5uq88yHc0x5nRQcpGgbGrkGSQhxkgaCnQ+NXlrX3 o0MA== X-Gm-Message-State: AOAM532+AB5eu8FKevLs14kUVv5nggmnpI+vU7PRV38xoYe9KbW9N7dg lEH3Vbg2QVlNP2LaUPIViCWXP9r4Ml/7g4SuK5I= X-Google-Smtp-Source: ABdhPJyivMKqmu6X7XsY/x9XlcQUthloLLvbpiYwLfl7JRlkrcRFXI9q3o+tKWuxjX0uC/pFLqqKlm26Yox7Bj+44zA= X-Received: by 2002:aa7:c151:: with SMTP id r17mr5096542edp.106.1609966301589; Wed, 06 Jan 2021 12:51:41 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Stefan Ring Date: Wed, 6 Jan 2021 21:51:30 +0100 Message-ID: Subject: Re: Possible bug in gcc-10.2 with non-type template parameter To: Edward Diener Cc: gcc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 20:51:44 -0000 On Mon, Jan 4, 2021 at 9:49 PM Edward Diener wrote: > > The code, called test_predicate.cpp, simplified from a much more > elaborate implementation: > > template < typename T, T *d > class atmp { atmp() {} }; > > template < typename T > struct ast > { > static T avar; > static atmp acst; > }; > > template < typename T > T ast::avar; > template < typename T > atmp::avar> ast::acst; > > int main() > { > return 0; > } > > The command line compile flags for gcc-10.2: > > -fvisibility-inlines-hidden -Wno-unused-local-typedefs > -ftrack-macro-expansion=0 -Wno-unused-variable > -D_GLIBCXX_USE_CXX11_ABI=1 -Wa,-mbig-obj -m64 -mthreads -O0 -fno-inline > -Wall -g -fvisibility=hidden -std=c++11 -c > > The result: > > test_predicate.cpp:10:47: error: conflicting declaration 'atmp ast::avar)> ast::acst' > 10 | template < typename T > atmp::avar> ast::acst; > | ^~~~~~ > test_predicate.cpp:6:26: note: previous declaration as 'atmp ast::avar)> ast::acst' > 6 | static atmp acst; > | ^~~~ > > The same source compiled with clang-11.0 and VC++14.2 succeeds with no > error. > > Is this s bug in gcc ? If so, is there a known workaround ? Hmm, I'm not a language lawyer, and the error message does not seem to make sense, but what happens when you remove the offending line in your real program?