Closed Bug 73171 Opened 24 years ago Closed 16 years ago

nsAutoString foo = NS_LITERAL_STRING("bar") should not compile on egcs-1.1.2

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: waterson, Assigned: jag+mozilla)

Details

This does not compile on Mac: nsAutoString foo = NS_LITERAL_STRING("bar"); Nor does this: nsAutoString foo = NS_LITERAL_STRING("bar").get(); Surprisingly, this does: nsAutoString foo(NS_LITERAL_STRING("bar")); I got bit by this when porting changes that compiled on egcs-1.1.2.
Severity: normal → minor
Keywords: mozilla0.9
This is as designed. All the single argument constructors are marked |explicit|. This helps us catch cases, e.g., where people declared |nsAutoString| parameters, etc. An unfortunate side-effect is that it also prevents them from being used in the copy-initialization form. Does egcs-1.1.2 somehow fail the `has |explicit|' test? I'm marking this WONTFIX because I think the safety of catching accidental copies is more important the convenience or elegance of using the copy-initialization form of construction. If you want to argue against this, then please re-open the bug and present your arguments.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
Yeah, egcs-1.1.2 compiled the above code. I haven't tried other compilers. Based on your comments, re-opening and changing summary to nsAutoString foo = NS_LITERAL_STRING("bar") should not compile on egcs-1.1.2
Status: RESOLVED → REOPENED
OS: Mac System 9.x → Linux
Hardware: Macintosh → PC
Resolution: WONTFIX → ---
Summary: nsAutoString foo = NS_LITERAL_STRING("bar") does not compile → nsAutoString foo = NS_LITERAL_STRING("bar") should not compile on egcs-1.1.2
sounds reasonable. egcs-1.1.2 is the latest, right? it had better have |explicit|. Hmmm, I don't think our |explicit| test is strong enough. See http://lxr.mozilla.org/seamonkey/source/configure.in#2635 This doesn't catch the case where the compiler recognizes |explicit| but doesn't actually do anything about it. We should add a `try compile' case that would fail if explicit were working (i.e., because the construction was denied). But this shouldn't be stopping egcs. It should already pass this test. What it is the output from this test in the config run for your egcs? Is there anything I need to do to prepare a W2K laptop to do a linux install (intended to be dual-boot)? If I can get linux installed on this new box, I can have a more direct impact on this bug.
Status: REOPENED → ASSIGNED
Keywords: mozilla0.9
Target Milestone: --- → mozilla0.9.1
re-targeting milestones, starting from a clean slate
Target Milestone: mozilla0.9.1 → ---
giving up ancient string bugs to the new string owner. jag, you'll want to sort through these and see which ones still apply and go with or against the direction in which you intend strings evolve
Assignee: scc → jaggernaut
Status: ASSIGNED → NEW
QA Contact: scc → string
Status: NEW → RESOLVED
Closed: 24 years ago16 years ago
Resolution: --- → INCOMPLETE
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.