Bug 90019 - [8 regression] Bogus ambiguous overload error for NTTP pack of disjoint enable_ifs unless there is an unsupplied default argument
Summary: [8 regression] Bogus ambiguous overload error for NTTP pack of disjoint enabl...
Status: RESOLVED DUPLICATE of bug 86932
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.3.0
: P2 normal
Target Milestone: 8.5
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2019-04-09 02:43 UTC by Mathias Stearn
Modified: 2021-05-14 12:58 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 7.4.0, 9.0
Known to fail: 8.1.0, 8.3.0
Last reconfirmed: 2019-04-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Stearn 2019-04-09 02:43:45 UTC
This code compiles fine with 7 and trunk but fails with gcc8: https://godbolt.org/z/v1HN8B

#include <type_traits>

// gcc8 thinks these are ambiguous for <0>
template <int I, std::enable_if_t<I == 0, int>...> void foo(){}
template <int I, std::enable_if_t<I != 0, int>...> void foo(){}

// but somehow these arn't for <0>, but are for <0,0> !?
template <int I, int=0, std::enable_if_t<I == 0, int>...> void bar(){}
template <int I, int=0, std::enable_if_t<I != 0, int>...> void bar(){}

void test() {
    bar<0>(); // works
    bar<0,0>(); // boom
    foo<0>(); // boom
}
Comment 1 Richard Biener 2019-04-09 10:19:30 UTC
Also seems to work on trunk, but it seems it was only fixed recently.  So maybe this one has a duplicate.
Comment 2 Jakub Jelinek 2020-03-04 09:39:51 UTC
GCC 8.4.0 has been released, adjusting target milestone.
Comment 3 Jakub Jelinek 2021-05-14 12:50:59 UTC
Started with r8-544-g0ea37ae178ba156ec9f88134acc4bb13665c56ef
Fixed for 9.1 with r9-6728-gce4609958f8db5cd64ec1c3bec624a36d8b35812
Therefore, dup of PR86932.

*** This bug has been marked as a duplicate of bug 86932 ***
Comment 4 GCC Commits 2021-05-14 12:58:15 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:d25809dbfe43917b3bed9454620fcc24f04c1e03

commit r12-799-gd25809dbfe43917b3bed9454620fcc24f04c1e03
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri May 14 14:56:28 2021 +0200

    testsuite: Add testcase for already fixed PR [PR90019]
    
    2021-05-14  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/90019
            * g++.dg/cpp0x/sfinae68.C: New test.