Bug 5921 – No mismatched nested comments

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-03T02:54:00Z
Last change time
2015-06-09T05:11:57Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-05-03T02:54:41Z
D2 program: /+ /* */+/ void main() {} DMD 2.052 prints (with no line number): Error: Source:Mismatched nested comments in test.d Tagged as 'major' because Don (almost) asked me to do this in a comment to bug 5745
Comment #1 by kennytm — 2011-05-03T06:03:13Z
Cannot reproduce the error message. Please show your dmd options. I've got x.d(6): unterminated /+ +/ comment in 2.052, 2.042 (ideone), 1.026 (codepad) and git master with 'dmd x'. Reducing severity back to 'normal'.
Comment #2 by bearophile_hugs — 2011-05-03T09:54:41Z
(In reply to comment #1) > Cannot reproduce the error message. Please show your dmd options. I've got Thank you, you are right, I've seen that the error message I see is generated by the build system I use and not by DMD. DMD shows the line number.
Comment #3 by bugzilla — 2011-05-03T10:30:56Z
Not a dmd issue, marked as invalid.
Comment #4 by bearophile_hugs — 2011-05-03T10:39:30Z
(In reply to comment #3) > Not a dmd issue, marked as invalid. But isn't it a DMD problem still? Maybe we have discussed this same problem in past, but the comments are not mismatched here.
Comment #5 by kennytm — 2011-05-03T10:58:33Z
(In reply to comment #4) > (In reply to comment #3) > > Not a dmd issue, marked as invalid. > > But isn't it a DMD problem still? Maybe we have discussed this same problem in > past, but the comments are not mismatched here. No they are mismatched. Inside a /+ ... +/, the /* ... */ is not special. Therefore, the tokenizer, using greedy match, recognizes the input as: <start-of-nestable-comment> /+ <comment-text> /* * <start-of-nestable-comment> /+ <comment-text> / void main() {} Therefore you have two +/ unmatched.
Comment #6 by bugzilla — 2011-05-03T12:13:25Z
Kenny's right. This is not a dmd bug.
Comment #7 by smjg — 2011-05-08T07:53:56Z
(In reply to comment #6) > Kenny's right. > > This is not a dmd bug. So why couldn't you explain this in the first place? Or did you somehow misread "rejects-valid" as "diagnostic"?