+2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/83434 - typeinfo of noexcept function
+ * rtti.c (get_tinfo_decl_dynamic): Do not call
+ TYPE_MAIN_VARIANT for function.
+ (get_typeid): Likewise.
+
2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
* parser.c (cp_parser_class_head): Improve error recovery upon
exp = resolve_nondeduced_context (exp, complain);
- /* peel back references, so they match. */
+ /* Peel back references, so they match. */
type = non_reference (unlowered_expr_type (exp));
/* Peel off cv qualifiers. */
- type = TYPE_MAIN_VARIANT (type);
+ type = cv_unqualified (type);
/* For UNKNOWN_TYPEs call complete_type_or_else to get diagnostics. */
if (CLASS_TYPE_P (type) || type == unknown_type_node
}
else
/* Otherwise return the type_info for the static type of the expr. */
- t = get_tinfo_ptr (TYPE_MAIN_VARIANT (type));
+ t = get_tinfo_ptr (type);
return cp_build_fold_indirect_ref (t);
}
/* The top-level cv-qualifiers of the lvalue expression or the type-id
that is the operand of typeid are always ignored. */
- type = TYPE_MAIN_VARIANT (type);
+ type = cv_unqualified (type);
/* For UNKNOWN_TYPEs call complete_type_or_else to get diagnostics. */
if (CLASS_TYPE_P (type) || type == unknown_type_node
--- /dev/null
+// { dg-options "-std=c++17" }
+// { dg-do run }
+
+#include <typeinfo>
+
+void f1();
+void f2() noexcept;
+int main() {
+ if((typeid(void()) == typeid(void ()noexcept))
+ || (typeid(&f1) == typeid(&f2))
+ || (typeid(f1) == typeid(f2)))
+ __builtin_abort();
+}