diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/parser.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/abbrev10.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/abbrev11.C | 10 |
3 files changed, 30 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 59adac4..e6e6ed7 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -26433,8 +26433,8 @@ cp_parser_member_declaration (cp_parser* parser) || !DECL_DECLARES_FUNCTION_P (decl)) finish_member_declaration (decl); - if (TREE_CODE (decl) == FUNCTION_DECL) - cp_parser_save_default_args (parser, decl); + if (DECL_DECLARES_FUNCTION_P (decl)) + cp_parser_save_default_args (parser, STRIP_TEMPLATE (decl)); else if (TREE_CODE (decl) == FIELD_DECL && DECL_INITIAL (decl)) /* Add DECL to the queue of NSDMI to be parsed later. */ diff --git a/gcc/testsuite/g++.dg/concepts/abbrev10.C b/gcc/testsuite/g++.dg/concepts/abbrev10.C new file mode 100644 index 0000000..b611346 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/abbrev10.C @@ -0,0 +1,18 @@ +// PR c++/99806 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +struct S { + void f(auto, auto, int = 3); + void f2(auto, auto, int = 3) { } + template<typename T> static T g(T, auto, int = 3); +}; + +void +g () +{ + S::g(1, 2); + S s; + s.f(1, 2); + s.f2(1, 2); +} diff --git a/gcc/testsuite/g++.dg/concepts/abbrev11.C b/gcc/testsuite/g++.dg/concepts/abbrev11.C new file mode 100644 index 0000000..ddb4793 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/abbrev11.C @@ -0,0 +1,10 @@ +// PR c++/99806 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template <typename T> concept C = requires (T a) { a.f(0); }; +struct S { + void f(auto) noexcept(B); + static constexpr bool B = true; +}; +static_assert(C<S>, ""); |