diff --git a/clang-tools-extra/pseudo/test/cxx/declarator-function.cpp b/clang-tools-extra/pseudo/test/cxx/declarator-function.cpp new file mode 100644 --- /dev/null +++ b/clang-tools-extra/pseudo/test/cxx/declarator-function.cpp @@ -0,0 +1,11 @@ +// The standard grammar allows an init-list with any declarator, including +// a function declarator. This creates an ambiguity where a function-definition +// is misparsed as a simple-declaration. +// FIXME: eliminate this false parse. +// XFAIL: * + +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s +void s(){}; +// CHECK-NOT: simple-declaration +// CHECK: function-definition := decl-specifier-seq declarator +// function-body CHECK-NOT: simple-declaration diff --git a/clang-tools-extra/pseudo/test/cxx/declarator-var.cpp b/clang-tools-extra/pseudo/test/cxx/declarator-var.cpp new file mode 100644 --- /dev/null +++ b/clang-tools-extra/pseudo/test/cxx/declarator-var.cpp @@ -0,0 +1,11 @@ +// The standard grammar allows an function-body to use any declarator, including +// a non-function declarator. This creates an ambiguity where a +// simple-declaration is misparsed as a function-definition. +// FIXME: eliminate this false parse. +// XFAIL: * + +// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s +void (*s)(){}; +// CHECK-NOT: function-definition +// CHECK: init-declarator := declarator initializer +// CHECK-NOT: function-definition