Issue 61500
Summary clang disallows having a pointer to subobject as a template argument
Labels new issue
Assignees
Reporter brevzin
    Short example:
```cpp
template <int const*>
constexpr int f()
{
    return 0;
}

struct X { int i; };
constexpr auto x = X{.i=1};
constexpr int xs = f<&x.i>();
```

Clang rejects (every version I've tried), saying:

> candidate template ignored: invalid explicitly-specified argument for 1st template parameter

But `&x.i` should meet all the requirements here - it is a pointer to `int const` and the object in question does have static storage duration (so it should be a permitted result of a constant _expression_). 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to