LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 16909 - Accepts-invalid with dependent name not prefixed with typename
Summary: Accepts-invalid with dependent name not prefixed with typename
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-16 00:04 PDT by Eli Friedman
Modified: 2016-11-22 06:27 PST (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eli Friedman 2013-08-16 00:04:10 PDT
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.
Comment 1 Ben Langmuir 2015-01-23 13:48:05 PST
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
}
Comment 2 Bob Wilson 2016-04-15 17:36:42 PDT
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