Summary: | Attribute [[deprecated]] causes diagnostic in never-instantiated template | ||
---|---|---|---|
Product: | gcc | Reporter: | Louis Dionne <ldionne.2> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | jakub, Laurent.Rineau__gcc, mpolacek, redi, webrown.cpp |
Priority: | P3 | Keywords: | diagnostic |
Version: | 12.0 | ||
Target Milestone: | --- | ||
See Also: | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33911 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Louis Dionne
2022-03-02 14:27:42 UTC
This is a consequence of treating attribute deprecated specially in is_late_template_attribute (it's not a late attribute). And I think this is the same problem as in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33911#c18. Not sure if we want to change anything. (In reply to Marek Polacek from comment #2) > And I think this is the same problem as in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33911#c18. Not sure if we want > to change anything. Yup, I agree this is the same problem. However, see my recent comment on that bug report -- I think we should still fix this, and the resolution of PR33911 was IMO incomplete. CCing Jonathan for insight on what libstdc++ is doing here with [[deprecated]]. Libstdc++ has the attribute on both of these templates. I used diagnostic pragmas to stop the function templates from warning about the use of the class templates. If other code refers to either of them, it gets a warning. But the use of unary_negate within std::not1 doesn't give a warning. I think I've argued in another bug that it might be reasonable to not warn about uses within the same header (since that is likely to be part of the same library, and the warnings are probably intended for users of the library code, not within the library itself). But in the absence of such a rule, disabling the warnings locally using pragmas seems reasonable to me. That works for any library, not just the std::lib. |