You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A coworker of mine just came across the same issue. I have another set of repros and a few cases that do work as expected. I've tested and reproduced the same error back to Clang 5.0 and through until trunk as of today. Interestingly enough it occurs during parsing and not during template instantiation.
template
struct S
{
S(T t) : t(t) {}
T t;
};
template
void good1(T v)
{
(void)S(v);
}
template
void good2(T v)
{
auto s = S(v);
(void)s.t;
}
Extended Description
Try to compile the following c++ program:
template
struct C {
C(T) {}
int a;
};
template
int foo(T v) {
return C{v}.a; // <----
}
int main() {
foo(4);
}
The line marked above fails with the error:
error: member reference base type 'C' is not a structure or union
return (C{v}).a;
~~~~~~^~
Note that the following all work fine:
template
C foo(T v) {
return C{v};
}
and
int foo(int v) {
return C{v}.a;
}
and
C{4}.a;
I tried this also on a recent trunk build (trunk 346600)
The text was updated successfully, but these errors were encountered: