1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
28e8fb3be5bd78f0564444eca02b404566a5f3b5dAndy Gibbs// expected-no-diagnostics
3a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
4a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregortemplate<typename T> struct identity;
5a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregortemplate<typename ...Types> struct tuple;
6a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
7a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregortemplate<typename T, typename U> struct is_same {
8a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor  static const bool value = false;
9a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor};
10a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
11a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregortemplate<typename T> struct is_same<T, T> {
12a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor  static const bool value = true;
13a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor};
14a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
15a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// There is a syntactic ambiguity when an ellipsis occurs at the end
16a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// of a parameter-declaration-clause without a preceding comma. In
17a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// this case, the ellipsis is parsed as part of the
18a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// abstract-declarator if the type of the parameter names a template
19a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// parameter pack that has not been expanded; otherwise, it is parsed
20a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// as part of the parameter-declaration-clause.
21a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
22a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregortemplate<typename T, typename ...Types>
23a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregorstruct X0 {
24603cfb4da2f7ba08a1c3452c2fbf70585b8e7621Douglas Gregor  typedef identity<T(Types...)> function_pack_1;
25603cfb4da2f7ba08a1c3452c2fbf70585b8e7621Douglas Gregor  typedef identity<T(Types......)> variadic_function_pack_1;
26a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor  typedef identity<T(T...)> variadic_1;
27a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor  typedef tuple<T(Types, ...)...> template_arg_expansion_1;
28a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor};
29a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
30a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
31a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor
32a8bc8c9e9ba5bffebde00340786fe8542469c435Douglas Gregor// FIXME: Once function parameter packs are implemented, we can test all of the disambiguation
33