Skip to content
Snippets Groups Projects
Commit a04426c5 authored by Douglas Gregor's avatar Douglas Gregor
Browse files

Extend the parser to support pack expansions within exception

specifications. We can't yet instantiate them, however, since I
tripped over PR8835.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122292 91177308-0d34-0410-b5e6-96231b3b80d8
parent 7ca7ac40
No related branches found
No related tags found
No related merge requests found
...@@ -1875,8 +1875,8 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { ...@@ -1875,8 +1875,8 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) {
/// [MS] 'throw' '(' '...' ')' /// [MS] 'throw' '(' '...' ')'
/// ///
/// type-id-list: /// type-id-list:
/// type-id /// type-id ... [opt]
/// type-id-list ',' type-id /// type-id-list ',' type-id ... [opt]
/// ///
bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc, bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc,
llvm::SmallVectorImpl<ParsedType> llvm::SmallVectorImpl<ParsedType>
...@@ -1908,10 +1908,21 @@ bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc, ...@@ -1908,10 +1908,21 @@ bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc,
SourceRange Range; SourceRange Range;
while (Tok.isNot(tok::r_paren)) { while (Tok.isNot(tok::r_paren)) {
TypeResult Res(ParseTypeName(&Range)); TypeResult Res(ParseTypeName(&Range));
if (Tok.is(tok::ellipsis)) {
// C++0x [temp.variadic]p5:
// - In a dynamic-exception-specification (15.4); the pattern is a
// type-id.
SourceLocation Ellipsis = ConsumeToken();
if (!Res.isInvalid())
Res = Actions.ActOnPackExpansion(Res.get(), Ellipsis);
}
if (!Res.isInvalid()) { if (!Res.isInvalid()) {
Exceptions.push_back(Res.get()); Exceptions.push_back(Res.get());
Ranges.push_back(Range); Ranges.push_back(Range);
} }
if (Tok.is(tok::comma)) if (Tok.is(tok::comma))
ConsumeToken(); ConsumeToken();
else else
......
...@@ -26,3 +26,21 @@ struct identity { ...@@ -26,3 +26,21 @@ struct identity {
tuple<int, float> *t_int_float; tuple<int, float> *t_int_float;
extract_nested_types<identity<int>, identity<float> >::types *t_int_float_2 extract_nested_types<identity<int>, identity<float> >::types *t_int_float_2
= t_int_float; = t_int_float;
// In a dynamic-exception-specification (15.4); the pattern is a type-id.
template<typename ...Types>
struct f_with_except {
virtual void f() throw(Types...);
};
// FIXME: the code below requires the ability to instantiate pack
// expansions whose pattern is a type-id.
#if 0
struct check_f_with_except_1 : f_with_except<int, float> {
virtual void f() throw(int, float);
};
struct check_f_with_except_2 : f_with_except<int, float> {
virtual void f() throw(int);
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment