[Bug c/81518] missing warning on a violation of attribute const requirements
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81518 Andrew Pinski changed: What|Removed |Added Keywords||diagnostic --- Comment #1 from Andrew Pinski --- There is not enough context to see if f violates the const attribute rules or not. The argument could be unused.
[Bug c/81518] missing warning on a violation of attribute const requirements
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81518 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #2 from Andrew Pinski --- Duplicated of bug 18487. *** This bug has been marked as a duplicate of bug 18487 ***
[Bug c/81518] missing warning on a violation of attribute const requirements
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81518 Andrew Pinski changed: What|Removed |Added Resolution|DUPLICATE |INVALID --- Comment #3 from Andrew Pinski --- Actually this is not a duplicated. Just not a bug. Function f is a declaration and not a definition so there is no way for GCC to know this part of the constraint: "and examines the data pointed to". So invalid.
[Bug c/81518] missing warning on a violation of attribute const requirements
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81518 Martin Sebor changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #4 from Martin Sebor --- I disagree. A warning would be helpful even in the absence of a definition and evidence that the function actually access the pointed to data. A warning would also be helpful that pointed out that "it does not make sense for a const function to return void" as the manual states. Finally, even if the warning shouldn't be issued for declarations without the evidence that the argument pointer isn't accessed, the warning could be triggered once a definition were seen that did violate these requirements.
[Bug c/81518] missing warning on a violation of attribute const requirements
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81518 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #5 from Martin Sebor --- And resolving as a duplicate of bug 18487 since the fine details of exactly when to issue the warning are secondary. The important part of the enhancement is to help the user write correct code. *** This bug has been marked as a duplicate of bug 18487 ***