Skip to content

Should reject C auto *f() when deduced return type doesn't satisfy C #53911

@Quuxplusone

Description

@Quuxplusone

Similar to #49188, but whereas in that issue the problem was an auto return type being deduced to void, here the problem is the auto in the return type being modified by a pointer qualification. For example: https://godbolt.org/z/T8j3j7j58

namespace Bug {
  template<class T> concept C = false;

  C auto *f() {
    return (int*)nullptr;
  }
}

This should be a hard error, because auto deduces to int and C<int> is false. But instead, Clang silently accepts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions