Issue 129573
Summary Reference argument specified as template can't be used in constexpr if
Labels new issue
Assignees
Reporter abellgithub
    Perhaps a duplicate of #63139

The following fails to compile with 19.1.0 and current trunk. It works if the argument is a value type instead of reference. Works with GCC.

```
class Foo
{
public:
    constexpr static bool foo = true;
};

template <typename T>
int func(T& t)
{
    if constexpr (t.foo)
    {
 return 1;
    }
    else
    {
        return 0;
    }
}

int main()
{
    Foo f;

    int i = func(f);
    return i;
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to