-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyconstexprAnything related to constant evaluationAnything related to constant evaluationcrash-on-validlambdaC++11 lambda expressionsC++11 lambda expressions
Description
Bugzilla Link | 34005 |
Version | trunk |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @Quuxplusone |
Extended Description
The code below fail to be compile.
// prog.cc
template<int> struct X {};
template<int n> constexpr void f(X<n>) {}
template<typename> constexpr int v = [](int r = 0l) constexpr { return r; }();
int main() {
f<v<int>>(X<0>());
}
$ clang++ -std=c++1z prog.cc
prog.cc:6:5: error: no matching function for call to 'f'
f<v<int>>(X<0>());
^~~~~~~~~
prog.cc:2:32: note: candidate function not viable: no known conversion from 'X<...>' to 'X<...>' for 1st argument
template<int n> constexpr void f(X<n>) {}
^
1 error generated.
I think v<T>
is always 0
, so f<v<int>>(X<0>())
should match f<0>(X<0>)
;
And if lambda's default parameter type is int
,
template<typename> constexpr int v = [](int r = 0) constexpr { return r; }();
There are no errors.
This link is the result executed by wandbox.
https://wandbox.org/permlink/yjKqrYKQyl2YZ6PO
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyconstexprAnything related to constant evaluationAnything related to constant evaluationcrash-on-validlambdaC++11 lambda expressionsC++11 lambda expressions