Skip to content

Fails to match template specialization with polymorphic non-type template argument #32470

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link33123
Version4.0
OSLinux
AttachmentsMonad Maybe test case
ReporterLLVM Bugzilla Contributor

Extended Description

In C++14 this code works, but in C++1z it produces an error meaning it can't find the specialization:

template <classT, T X> structA {}; template <classT, classU> structB {}; template <classT, T X> structB<T, A<T, X>> { using result = T; }; staticconstexprdouble input = 1.; intmain() { using result1 = typename B<int, A<int, 15>>::result; // OKusing result2 = typename B<constdouble*, A<constdouble*, &input>>::result; // OKusing result3 = typename B<constdouble&, A<constdouble&, input>>::result; // Error }
testcase4.cpp:19:71: error: no type named 'result' in 'B<const double &, A<const double &, &input> >' using result3 = typename B<const double&, A<const double&, input>>::result; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ 

I've attached a more complete example testcase.cpp that works in C++14 mode (prints the value 1) but in C++1z fails to compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++17clang: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

      close