diff options
Diffstat (limited to 'test/Parser/cxx-ambig-paren-expr.cpp')
-rw-r--r-- | test/Parser/cxx-ambig-paren-expr.cpp | 40 |
1 files changed, 40 insertions, 0 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; +} + |