Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template non-type with decltype(auto) placeholder does not work with template specialization when a reference is passed #38721

Open
narutse opened this issue Oct 21, 2018 · 1 comment
Labels
bugzilla Issues migrated from bugzilla c++17

Comments

@narutse
Copy link

narutse commented Oct 21, 2018

Bugzilla Link 39373
Version 7.0
OS Linux

Extended Description

Code:

#include <type_traits>
#include

// definition
template <bool, decltype(auto)> struct X : std::false_type {};
// sepcialization
template <decltype(auto) val>
struct X<true, val> : std::true_type {};

using namespace std;

const double d = 10.0;

int main()
{
cout << X<true, 1>::value << '\n';
cout << X<true, (d)>::value << '\n';
}

Will print out 1 and 0, which means that it fails to specialize the (d) reference version. I tried it on gcc and it prints 1 and 1. Alternatively, if I left struct X undefined in the declaration (instead of inheriting from false_type), it will give me a compiler error "implicit instantiation of undefined template" only for the second instantiation, whereas in gcc it will succeed instantiating both.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#40983

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++17
Projects
None yet
Development

No branches or pull requests

2 participants