diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Parser/cxx-ambig-paren-expr.cpp | 40 | ||||
-rw-r--r-- | test/SemaTemplate/metafun-apply.cpp | 6 |
2 files changed, 42 insertions, 4 deletions
diff --git a/test/Parser/cxx-ambig-paren-expr.cpp b/test/Parser/cxx-ambig-paren-expr.cpp index 31633a58d7..3988205672 100644 --- a/test/Parser/cxx-ambig-paren-expr.cpp +++ b/test/Parser/cxx-ambig-paren-expr.cpp @@ -24,3 +24,43 @@ void f() { // FIXME: Special case: "++" is postfix here, not prefix // (S())++; } + +// Make sure we do tentative parsing correctly in conditions. +typedef int type; +struct rec { rec(int); }; + +namespace ns { + typedef int type; + struct rec { rec(int); }; +} + +struct cls { + typedef int type; + struct rec { rec(int); }; +}; + +struct result { + template <class T> result(T); + bool check(); +}; + +void test(int i) { + if (result((cls::type) i).check()) + return; + + if (result((ns::type) i).check()) + return; + + if (result((::type) i).check()) + return; + + if (result((cls::rec) i).check()) + return; + + if (result((ns::rec) i).check()) + return; + + if (result((::rec) i).check()) + return; +} + diff --git a/test/SemaTemplate/metafun-apply.cpp b/test/SemaTemplate/metafun-apply.cpp index 4044d14a84..bb3c88ad39 100644 --- a/test/SemaTemplate/metafun-apply.cpp +++ b/test/SemaTemplate/metafun-apply.cpp @@ -32,11 +32,9 @@ apply1<add_reference, int>::type ir = i; apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}} void test() { - apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} \ - // FIXME: expected-error{{unexpected type name 'type': expected expression}} + apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} - apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} \ - // FIXME: expected-error{{unexpected type name 'type': expected expression}} + apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} } |