@@ -20786,9 +20786,13 @@ cp_parser_simple_type_specifier (cp_parser* parser,
}
/* If it didn't work out, we don't have a TYPE. */
- if ((flags & CP_PARSER_FLAGS_OPTIONAL)
- && !cp_parser_parse_definitely (parser))
- type = NULL_TREE;
+ if (flags & CP_PARSER_FLAGS_OPTIONAL)
+ {
+ if (!type)
+ cp_parser_simulate_error (parser);
+ if (!cp_parser_parse_definitely (parser))
+ type = NULL_TREE;
+ }
/* Keep track of all name-lookups performed in class scopes. */
if (type
new file mode 100644
@@ -0,0 +1,18 @@
+// PR c++/116071
+// { dg-options "-std=c++14 -fconcepts" }
+
+template<class T> struct S { ~S(); };
+template<class T> S<T>::~S() { }
+
+template<typename MemPtr>
+struct result_of;
+
+template<typename Res, typename Class>
+struct result_of<Res Class::*>
+{
+ using type = void;
+};
+
+struct thread {
+ void join() { };
+};