Closed ec04fc15-fa35-46f2-80e1-5d271f2ef708 closed 10 years ago
I observed the behaviour requested in the report in r214060.
$ clang -cc1 -std=c++11 -x c++ pr13610.cc pr13610.cc:3:6: error: variable has incomplete type 'void' auto x = f((char (*)[1000])0); ^ 1 error generated.
presumably because the narrowing case is a DefaultError Warning rather than actually being an Error.
This analysis isn't right... the issue is that we don't ever re-analyze the list when it gets instantiated. Sema::BuildCXXTypeConstructExpr has a check for whether the arguments are type-dependent; maybe it needs to check value dependence as well?
Extended Description
This code should not compile:
template decltype(char{sizeof(T)}) f(T);
void f(...);
auto x = f((char ()[1000])0);
... because SFINAE should reject the template due to the narrowing error, and thus we should pick the variadic and fail when auto type deduction deduces 'void'. But we don't, we pick the template, presumably because the narrowing case is a DefaultError Warning rather than actually being an Error.