Skip to content

Clang 20 regression: conflicting deduction 'type-parameter-0-0' against 'long' for parameter #138078

Open
@jeremy-rifkin

Description

@jeremy-rifkin
#include <type_traits>

template <typename Integer, Integer C, unsigned I, template <typename, Integer, unsigned> class Trait, typename = void>
class Foo : public std::integral_constant<bool, true> {};

template <typename Integer, Integer C, unsigned I>
class Bar : public std::integral_constant<bool, Foo<Integer, C, I, Bar>::value> {};

template <typename Integer, Integer C>
class Bar<Integer, C, 0> : public std::false_type {};

template <typename Integer, unsigned I>
class Baz : public std::integral_constant<bool, Bar<Integer, 1, I>::value> {};

Baz<long, 20> x;

This ostensibly valid code compiles fine on gcc, msvc, and clang 19 but fails on clang 20 with the following error:

<source>:6:20: error: conflicting deduction 'type-parameter-0-0' against 'long' for parameter
    6 | template <typename Integer, Integer C, unsigned I>
      |                    ^
<source>:7:68: note: template template argument has different template parameters than its corresponding template template parameter
    7 | class Bar : public std::integral_constant<bool, Foo<Integer, C, I, Bar>::value> {};
      |                                                                    ^
<source>:3:97: note: previous template template parameter is here
    3 | template <typename Integer, Integer C, unsigned I, template <typename, Integer, unsigned> class Trait, typename = void>
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       ^
<source>:13:49: note: in instantiation of template class 'Bar<long, 1, 20>' requested here
   13 | class Baz : public std::integral_constant<bool, Bar<Integer, 1, I>::value> {};
      |                                                 ^
<source>:15:15: note: in instantiation of template class 'Baz<long, 20>' requested here
   15 | Baz<long, 20> x;
      |               ^

https://godbolt.org/z/vjYsWPq3q

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions