[SERVER-17728] typeid(glvalue) warns on clang 3.6 Created: 24/Mar/15 Updated: 08/Jan/24 Resolved: 08/May/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.5, 3.1.3 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Mira Carey | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Backport Completed: | |||||||||
| Steps To Reproduce: | #using clang 3.6 |
||||||||
| Sprint: | Platform 3 05/15/15 | ||||||||
| Participants: | |||||||||
| Description |
|
Clang 3.6 added a new warning for the use of typeid with glvalue's. I.e. in situations where the argument is an expression and it would have to be evaluated with possible side effects. Error:
This appeared in: ------------ We have two options moving forward: Add a suppression:
Change two points in the code to clean this up (the below patch is sufficient for me)
Basically just do whatever side effecty stuff we need to before the call to typeid. |
| Comments |
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||||||||||||||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: (cherry picked from commit 1d9b83f16314cdb1e9da4b5c853870f10abb49df) | |||||||||||||||||||||||||||||
| Comment by Andrew Morrow (Inactive) [ 11/Jun/15 ] | |||||||||||||||||||||||||||||
|
amw - We are evaluating your request to have the fix for this issue backported to v3.0. In the meantime, please be aware that it is possible to disable warnings as errors on all recent stable branches by passing the --disable-warnings-as-errors flag to SCons, which should unblock building 3.0 releases on El Capitan. | |||||||||||||||||||||||||||||
| Comment by Adam Wróbel [ 11/Jun/15 ] | |||||||||||||||||||||||||||||
|
Just tried 3.1.4 on OS X 10.11.b1 and it compiled just fine.
| |||||||||||||||||||||||||||||
| Comment by Adam Wróbel [ 11/Jun/15 ] | |||||||||||||||||||||||||||||
|
This warning turns out to be compilation error on 10.11 El Capitan.
Would be nice if you could backport this into 3.0.4. | |||||||||||||||||||||||||||||
| Comment by Githook User [ 08/May/15 ] | |||||||||||||||||||||||||||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: | |||||||||||||||||||||||||||||
| Comment by Andrew Morrow (Inactive) [ 08/May/15 ] | |||||||||||||||||||||||||||||
|
mira.carey@mongodb.com knows more of the details, but I believe the issue is that the compiler may or may not evaluate the expression within. So, if you were expecting side effects to happen, they might not. We aren't relying on side effects, and uses of typeid should be exceedingly rare within our codebase. | |||||||||||||||||||||||||||||
| Comment by Eric Milkie [ 08/May/15 ] | |||||||||||||||||||||||||||||
|
I'm confused about this warning. Is it there because people might think typeid() works like sizeof()? |