[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557880#action_12557880 ] Martin Sebor commented on STDCXX-605: - Travis, after you've confirmed that your change (http://svn.apache.org/viewvc?view=rev&revision=610576) fixes the problem in nightly builds we need to remember to merge it to 4.2.1 and update the xfail file: http://svn.apache.org/repos/asf/incubator/stdcxx/trunk/etc/config/xfail.txt > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605-out.patch, stdcxx-605-v1.patch, > stdcxx-605-v2.patch, stdcxx-605-v3.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556723#action_12556723 ] Martin Sebor commented on STDCXX-605: - Do you want to try to commit it now that you have commit privs? > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605-out.patch, stdcxx-605-v1.patch, > stdcxx-605-v2.patch, stdcxx-605-v3.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556714#action_12556714 ] Travis Vitek commented on STDCXX-605: - Dandy. > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605-out.patch, stdcxx-605-v1.patch, > stdcxx-605-v2.patch, stdcxx-605-v3.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551653 ] Martin Sebor commented on STDCXX-605: - Hmmm. I tried to change the patch to show you what I meant with the const but I'm just getting an exception. I guess I don't understand how it works... Why can't one overload of retrieve be const and the other non-const, like this: template T& retrieve (T*); template const T& retrieve (const T*) const; I was hoping to then define the conversion operators like so: template operator T& () { return retrieve ((T*)0); } template operator const T& () const { return retrieve ((T*)0); } But when I do this and run it I get this on stdout: static_cast(v1 = 1) = exception > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551167 ] Martin Sebor commented on STDCXX-605: - Looks like you've been able to come up with a clean solution after all -- excellent! I do have one question about the patch to make sure I understand how it works: do both overloads of retrieve() need to be const? It seems that the one returning (non-const) T& should be non-const, no? (And shouldn't the call to the const overload cast the argument to const T* instead of plain T*?) Also, there are a few gratuitous whitespace edits in the patch (unnecessarily added newlines) that should normally be avoided, and a few formatting issues (missing spaces before open parens). > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550251 ] Travis Vitek commented on STDCXX-605: - 1. Yes, all of this is because of the compiler bug. As it turns out, a similar problem exists for some builds on VC7.1. 2. I think I can do it, but the only way I can come up with involves quite a bit of template metaprogramming and that adds a lot of complication to the example. Perhaps I'm persuing the wrong method? If not, I'd hope that we could come up with a simpler solution. I'd almost prefer to use named methods for doing the conversions. 3. Fine. 4. I'll file another bug on that issue. I've wasted enough time on this particular goose-chase already. > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549616 ] Martin Sebor commented on STDCXX-605: - I assume (1) is because of the compiler bug? For (2) yes, if we can't have static_cast(v) because of the XLC++ bug I'd rather see static_cast(v). The problem, as I understand it, is that we're invoking the conversion operator on a non-const dynatype object and thus operator T&() rather than operator const T&() const is being invoked. I wonder if there's a way to detect that the caller is invoking a const T& cast and dispatch to a const member function instead... (3) Yes. I'm saying I think the output of the example should match the code (and use '\n' instead of std::endl). (4) We should try. Is the difference due to unspecified behavior or another compiler bug? (Have fun reading the relevant sections of the standard! ;-) > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549606 ] Travis Vitek commented on STDCXX-605: - 1. The original code casted to values. We can't cast to values, unless you'd like to cast to a reference first, then cast the result to a value. Of course that is already happening behind the scenes, so I see no reason to be so explicit unless required. 2. I'm assuming that you'd rather see `static_cast(v1)' over `static_cast(v1)'. If that is the case, then yes, I'd like to cast to const references also. Unfortunately you can't because `const T' is a different type than `T' when it comes to templates. The non-const template conversion operator gets invoked, and the dynatype tries to look itself up in the map, which fails, and throws an exception. I could const_cast the dynatype, then cast that, but that is even more hideous that what I've got now... std::cout << "double (v2 = v1) = " << static_cast(const_cast(v2)) << std::endl; I started to write named helper methods (get<>, get_ref<>, get_cref<>) to retrieve the value after applying the cast, but that seemed wrong because the `dynatype' is supposed to look and feel just like an object of type T, and adding special functions to make it behave that way seems wrong. 3. Are you saying you want me to modify the output spew to match the code, like so... std::cout << "static_cast(v2 = v1) = " << static_cast(v2) << std::endl; 4. The output is slightly different between AIX and Linux. Linux/GCC appear to evaluate all of the arguments before calling the stream functions, and AIX/VisualAgeC++ seem to invoke the arguments as they are needed. This causes a diff in the output, which will probably be flagged as a failure. Should I fix this also? > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549587 ] Martin Sebor commented on STDCXX-605: - I think this should work. One question though: do we need to cast to references instead of values? If we do, I'd rather it be to const references if possible since the objects aren't being modified. In any case, we should probably also change the output of the example to look like the code (and, while you're there, replace std::endl with '\n' for efficiency). > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549268 ] Martin Sebor commented on STDCXX-605: - I don't think the patch is appropriate. The comment above the function says: "retrieve a const reference to the concrete type from an instance of dynatype throws std::bad_cast if the types don't match exactly." It seems that changing the return type from const T& to T might change the semantics of the function in some cases by introducing a conversion where one wouldn't otherwise be allowed. It's also inefficient. I realize this is just an example, but it's an example of a generic container that should be efficient. Btw., do we have an External issue for this bug (and have we opened a PMR with IBM for it)? I'd like to link them together so we can track the vendor's progress on their bug without cluttering this issue. > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > Attachments: stdcxx-605.patch > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-605) [IBM XLC++] errors compiling dynatype.cpp
[ https://issues.apache.org/jira/browse/STDCXX-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546445 ] Travis Vitek commented on STDCXX-605: - This appears to be a compiler bug. Here is a simple testcase. [EMAIL PROTECTED] examples]$ cat t.cpp && xlCcore -g -q64 t.cpp template T& get () { static T v = T(); return v; } struct A { template operator const T& () const { return get(); } }; int main () { A a; (int)a; return 0; } "t.cpp", line 20.10: 1540-0216 (S) An expression of type "A" cannot be converted to type "int". Making an explicit call to `a.operator const int& ()' works, as does a cast to `const int&' before the cast to `int'. It appears that the compiler isn't seeing that it can get an `int' by applying one of the conversion operators. Possible workarounds are to explicitly call the conversion operator, do an additional cast, or change the conversion operator to be an exact match. i.e. `operator T () const'. > [IBM XLC++] errors compiling dynatype.cpp > - > > Key: STDCXX-605 > URL: https://issues.apache.org/jira/browse/STDCXX-605 > Project: C++ Standard Library > Issue Type: Bug > Components: Examples >Affects Versions: 4.2.0 > Environment: XLC++ 6.0 through 9.0/AIX 5.3 >Reporter: Martin Sebor >Assignee: Travis Vitek > Fix For: 4.2.1 > > > The dynatype.cpp example program fails to compile with IBM XLC++ 9.0 on AIX > with ethe following errors: > xlCcore_r -c -I$(TOPDIR)/include/ansi-I$(TOPDIR)/include > -I$(BUILDDIR)/include -I$(TOPDIR)/examples/include -O -Q > -qtemplateregistry=dynatype.ti $(TOPDIR)/examples/tutorial/dynatype.cpp > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 203.27: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "int". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 209.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 215.30: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "double". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 222.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 228.35: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "const char *". > "$(TOPDIR)/examples/tutorial/dynatype.cpp", line 238.28: 1540-0216 (S) An > expression of type "dynatype" cannot be converted to type "char". > gmake: *** [dynatype.o] Error 1 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.