Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Accepts-invalid with dependent name not prefixed with typename #16908

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR16909
Status NEW
Importance P normal
Reported by Eli Friedman (efriedma@quicinc.com)
Reported on 2013-08-16 00:04:10 -0700
Last modified on 2016-11-22 06:27:21 -0800
Version unspecified
Hardware PC Windows NT
CC arphaman@gmail.com, blangmuir@apple.com, bob.wilson@apple.com, dgregor@apple.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Testcase:

template <typename,typename>
struct base {
  template <typename> struct derived;
};
template <typename T, typename U, typename V> base<T, U>::derived<V> foo();

We should print an error about the missing typename and template keywords.
Quuxplusone commented 9 years ago
This can also cause assertion failures or generate invalid IR:

template<typename T> struct A {
  template<typename U> struct B {};
};
struct C {};
template<typename T> A<T>::B<T> begin(const T &);

void test() {
  auto __begin = begin(5); // asserts because we didn't deduce the type of __begin
  for (auto &&x : C()); // without assertions, will produce invalid LLVM IR
}
Quuxplusone commented 8 years ago
This is also tracked as rdar://problem/19438432.

Ben proposed a patch:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150126/122055.html