Issue 160776
Summary diagnose_if fails on constructor templates when the _expression_ is argument-independent
Labels new issue
Assignees
Reporter higher-performance
    This test case for `clang/test/SemaCXX/diagnose_if.cpp` fails:
```
struct ConstructorTemplate {
  template <class T>
  explicit ConstructorTemplate(T x)
 _diagnose_if(sizeof(T) == sizeof(char), "oh no", "error") {}
};

void run() {
  ConstructorTemplate('1'); // expected-error{{oh no}}
}
```

Replacing `sizeof(T)` with `sizeof(x)` makes it succeed. It seems the code path for `diagnoseArgIndependentDiagnoseIfAttrs` isn't called in some cases that it's supposed to, but I got lost trying to track it down.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to