Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign #4814

Merged
merged 1 commit into from
Jul 19, 2015

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Jul 14, 2015

https://issues.dlang.org/show_bug.cgi?id=14541

The "error reproduction instantiation" might succeed to finish semantic analysis by the forward reference resolution. When it happens, the cached error instance needs to be overridden by the succeeded instance.


alias T = typeof(result);
static assert(hasElaborateAssign!T);
// hasElablrateAssign!(Tuple(int, int)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/hasElablrateAssign/hasElaborateAssign/g
s/alredy/already/g

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@rainers
Copy link
Member

rainers commented Jul 15, 2015

I'm not really qualified to comment sensibly, but getting a different result while trying to reproduce an error message seems strange. Should the retrying be part of the actual instantiation?
Could the same happen with a third invocation, i.e. the first two produce an error, but the third does not?

…orward reference in Tuple.opAssign

The "error reproduction instantiation" might succeed to finish semantic analysis by the forward reference resolution. When it happens, the cached error instance needs to be overridden by the succeeded instance.
@9rnsr
Copy link
Contributor Author

9rnsr commented Jul 16, 2015

getting a different result while trying to reproduce an error message seems strange.

Thanks for your understanding and question. In short, the two instantiations are not exactly same things. (Sorry my old comment was not good.)
Please read the updated comments explaining the point of issue.

@rainers
Copy link
Member

rainers commented Jul 17, 2015

Thanks for explanations. I agree that caching the successful result is an improvement, and I'm going to merge this if there are no other objections.
But the existing design seems to be pretty brittle:

enum hasElaborateAssign(T) = is(typeof(foo!T())) || true;

//static assert(hasElaborateAssign!int);
static assert(is(typeof(foo!int())));

void foo(T)()
{
    static assert(hasElaborateAssign!T);
}

This compiles, but if you insert the static assert in the third line, you get an error test.d(4): Error: static assert (is(typeof(__error))) is false, i.e. the assertion that passed before, suddenly fails.

@rainers
Copy link
Member

rainers commented Jul 17, 2015

Auto-merge toggled on

@9rnsr
Copy link
Contributor Author

9rnsr commented Jul 17, 2015

But the existing design seems to be pretty brittle:

Oh, that's brilliant small snippet. That's just an opposite pattern of issue 14541.
I have a quick fix for that, but it would also need more thought for the performance.

Could you please file the issue in bugzilla in order not to forget it.

@rainers
Copy link
Member

rainers commented Jul 17, 2015

Could you please file the issue in bugzilla in order not to forget it.

Done: https://issues.dlang.org/show_bug.cgi?id=14803

@9rnsr
Copy link
Contributor Author

9rnsr commented Jul 17, 2015

Thanks!

@rainers
Copy link
Member

rainers commented Jul 19, 2015

Not sure why the auto-merge was disabled, retrying...

@rainers
Copy link
Member

rainers commented Jul 19, 2015

Auto-merge toggled on

rainers added a commit that referenced this pull request Jul 19, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
@rainers rainers merged commit 0b0d373 into dlang:master Jul 19, 2015
@9rnsr
Copy link
Contributor Author

9rnsr commented Jul 19, 2015

Oh, I didn't notice that... thanks again.

@9rnsr 9rnsr deleted the fix14541 branch July 19, 2015 10:23
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 7, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 10, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 28, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 28, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 28, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 28, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Aug 28, 2015
Issue 14541 - "duplicate COMDAT" linker error with the template forward reference in Tuple.opAssign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants