+2014-11-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ DR 1510
+ PR c++/60420
+ * cp-tree.h (struct cp_decl_specifier_seq): Add decltype_p bool field.
+ * decl.c (grokdeclarator): Use it.
+ * parser.c (cp_parser_simple_type_specifier): Likewise.
+ * pt.c (tsubst, case DECLTYPE_TYPE): Use tf_ignore_bad_quals.
+
2014-11-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/63265
BOOL_BITFIELD explicit_char_p : 1;
/* True iff ds_thread is set for __thread, not thread_local. */
BOOL_BITFIELD gnu_thread_keyword_p : 1;
+ /* True iff the type is a decltype. */
+ BOOL_BITFIELD decltype_p : 1;
} cp_decl_specifier_seq;
/* The various kinds of declarators. */
type_quals |= cp_type_quals (type);
type = cp_build_qualified_type_real
- (type, type_quals, ((typedef_decl && !DECL_ARTIFICIAL (typedef_decl)
+ (type, type_quals, ((((typedef_decl && !DECL_ARTIFICIAL (typedef_decl))
+ || declspecs->decltype_p)
? tf_ignore_bad_quals : 0) | tf_warning_or_error));
/* We might have ignored or rejected some of the qualifiers. */
type_quals = cp_type_quals (type);
{
type = token->u.value;
if (decl_specs)
- cp_parser_set_decl_spec_type (decl_specs, type,
- token,
- /*type_definition_p=*/false);
+ {
+ cp_parser_set_decl_spec_type (decl_specs, type,
+ token,
+ /*type_definition_p=*/false);
+ /* Remember that we are handling a decltype in order to
+ implement the resolution of DR 1510 when the argument
+ isn't instantiation dependent. */
+ decl_specs->decltype_p = true;
+ }
cp_lexer_consume_token (parser->lexer);
return type;
}
return cp_build_qualified_type_real (type,
cp_type_quals (t)
| cp_type_quals (type),
- complain);
+ complain | tf_ignore_bad_quals);
}
case UNDERLYING_TYPE:
+2014-11-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ DR 1510
+ PR c++/60420
+ * g++.dg/cpp0x/decltype61.C: New.
+
2014-11-12 H.J. Lu <hongjiu.lu@intel.com>
PR tree-optimization/63835
--- /dev/null
+// DR 1510, PR c++/60420
+// { dg-do compile { target c++11 } }
+
+struct MyIter
+{
+ int& operator*();
+};
+
+void foo(MyIter begin)
+{
+ auto x = [](const decltype(*begin)) { };
+}
+
+template<typename Iterator>
+void bar(Iterator begin)
+{
+ auto x = [](const decltype(*begin)) { };
+}
+
+template void bar<MyIter>(MyIter);