Page MenuHomePhabricator

[Sema] Avoids an assertion failure when an invalid conversion declaration is used
Needs ReviewPublic

Authored by Mordante on Jul 16 2019, 2:22 PM.

Details

Reviewers
rsmith
Summary

When using a user-defined conversion function template with a deduced return type the compiler gives a set of warnings:

bug.cc:252:44: error: cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const'
  template <typename... Ts> operator auto()(Ts &&... xs) const;
                                           ^~~~~~~~~~~~~~~~~~~
bug.cc:252:29: error: conversion function cannot convert to a function type
  template <typename... Ts> operator auto()(Ts &&... xs) const;
                            ^
error: pointer to function type cannot have 'const' qualifier

after which it triggers an assertion failure. It seems the last error is incorrect and doesn't have any location information. This patch stops the compilation after the second warning.

Fixes bug 31422.

Diff Detail

Event Timeline

Mordante created this revision.Jul 16 2019, 2:22 PM
lebedev.ri retitled this revision from Avoids an assertion failure when an invalid conversion declaration is used to [Sema] Avoids an assertion failure when an invalid conversion declaration is used.Sat, Aug 17, 6:04 AM