sammccall added a subscriber: rsmith.
sammccall added a comment.

Neither of the testcases look like the right behavior to me, and I think the 
bug is elsewhere in clang.

The crux is we're forcing `decltype(N)` to be a (unique) dependent type, which 
feels wrong.
This isn't specific to error-dependence, the same is true in

  template <int K> void foo() {
    constexpr int N = K;
    decltype(K) // dependent?
  }

ASTContext::getDecltypeType() has to determine whether 
http://eel.is/c++draft/temp.type#4 applies.
There are three behaviors:

- standard up to C++14: traversing the expr looking for a template param to be 
lexically included (this is my reading of the standard)
- what clang actually does: check instantiation dependence, which I think pulls 
in too many cases
- standard after http://wg21.link/cwg2064: check type dependence

I think it's probably OK to adopt the C++17 behavior for all versions (if I'm 
right that the current behavior is a bug).
@rsmith It's your DR, what do you think :-)

(Per offline discussion, this was reduced from a related bug that didn't 
involve decltype, but I think we should treat that one as distinct)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86048/new/

https://reviews.llvm.org/D86048

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to