From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 7F8AD385B835 for ; Sat, 18 Apr 2020 19:51:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7F8AD385B835 Received: by mail-wr1-x42f.google.com with SMTP id b11so7100105wrs.6 for ; Sat, 18 Apr 2020 12:51:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Xu0HNqTbSsHt/OGqI+UlYpwMqxbsVjw7E7hWrbhHezM=; b=QU0It1tk7MSz0SaSrHVGL33nlqfKmqxAEjnLt7fhn5Er3/YkBmnYzsPE7zvUL/mYj0 GVJIvwieC4RWkiJBQSxUy6gp1ltHH8Bv12tKQ1Af2YFV8RFR0C8+q52aXmSpGPMr8F46 juJeHEnJ4uZ67WIJemDfw6zkxqSU/UYY/ZJLUHLzdn+rIumGB4SqDl9jDKpFQypCRJ3h Qr8AGrbIQGoAdLjkoKA2nTuhAnyygajOHjlCwBVAaQo7N6KLvgd+Jsqtd0S+q/nEqeW0 CUu7aRKQb6EOm7l+S0+6z3rVgpwKEEW8/CCHVLiFsWJbv5pbQMKLL2KzjRz3nGzAjU8W HaEQ== X-Gm-Message-State: AGi0PuaNd/yThdBgbCxdVIBLXjXJMe8t0wj6sXRkAqPZXu9xlWOlRC0D uhh20opltMIxv9sbHhlzfNS9XX096VL5DYPjSoS/sTy3HqbC9w== X-Google-Smtp-Source: APiQypLB6B6Rw2RqPalM93IRA85+Y35hBA+G5wZpsYhuN3TFfIyomLni3KB5KPm2Jl8LB9eMDeR9tYto2vcWxLGaaNQ= X-Received: by 2002:adf:e3ca:: with SMTP id k10mr11108271wrm.53.1587239502926; Sat, 18 Apr 2020 12:51:42 -0700 (PDT) MIME-Version: 1.0 From: Bence Kodaj Date: Sat, 18 Apr 2020 21:51:31 +0200 Message-ID: Subject: GCC 9.2, partial specialization with non-type template parameters: bug or not? To: gcc-help@gcc.gnu.org X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_2, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Sat, 18 Apr 2020 19:51:46 -0000 Dear list members, I'd like to ask for your help with the following: in GCC 9.2., is partial template specialization expected to work for *all* allowed non-type template parameters of class type? For a concrete example, please see the code below: it prints "false, true", i.e., apparently, specializing T for X< Int > does not succeed, whereas it does for Y< int >. Since Int is now (in C++20) allowed to be used as the type of non-type template parameters, one would naively expect the specialization of T for X< Int > to succeed just like the one for Y< int > does. Is this belief justified, or am I missing something? Disclaimer: I do realize that C++20 support in GCC 9 is experimental - I'm just looking for clarity regarding this issue, i.e., does the C++20 (draft) standard require that the code below print "true, true"? Best regards, Bence Kodaj ------------- - Compiler version (from g++ -v): gcc version 9.2.1 20191102 (Ubuntu 9.2.1-17ubuntu1~18.04.1) - Compilation command: g++ -std=c++2a main.cpp - Code: #include #include struct Int { constexpr Int(int v): value{ v } {} const int value; }; template< Int i > struct X {}; template< int i > struct Y {}; template< typename > struct T : std::false_type {}; template< Int i > struct T< X< i > > : std::true_type {}; template< int i > struct T< Y< i > > : std::true_type {}; int main() { std::cout << std::boolalpha << T< X< 123 > >::value << ", " << T< Y< 123 > >::value << "\n"; return 0; }