Issue 91650
Summary Identical return type considered different in redeclaration with trailing return type and enough templates
Labels new issue
Assignees
Reporter davidstone
    The following valid code:

```c++
template<bool>
struct enable_if {
	using type = void;
};

template<typename>
struct trait {
	static constexpr bool value = false;
};

template<typename T>
struct s {
 typename enable_if<trait<T>::value>::type assign();
};

template<typename T>
auto s<T>::assign() -> typename enable_if<trait<T>::value>::type {
}
```

is rejected by clang with

```console
<source>:17:12: error: return type of out-of-line definition of 's::assign' differs from that in the declaration
   17 | auto s<T>::assign() -> typename enable_if<trait<T>::value>::type {
      |            ^
<source>:13:45: note: previous declaration is here
   13 |   typename enable_if<trait<T>::value>::type assign();
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.
Compiler returned: 1
```

This occurred on clang trunk very recently, so it's not yet showing up on Godbolt: https://godbolt.org/z/KTE7dvcjd

@sdkrystian: It was introduced by 62b5b61f436add042d8729dc9837d055613180d9.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to