| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0010367 | GCC-XML | public | 2010-03-04 09:43 | 2015-03-26 11:59 | |||||
| Reporter | axel | ||||||||
| Assigned To | Brad King | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | resolved | Resolution | suspended | ||||||
| Platform | OS | OS Version | |||||||
| Summary | 0010367: templated c'tor gets instantiated as copy c'tor | ||||||||
| Description | According to 12.8.3 ("A member function template is never instantiated to perform the copy of a class object to an object of its class type"), the following code should not instantiate the templated constructor as a copy constructor. It should not be visible in GCCXML's output, just like h() is not visible. With a recent GCCXML snapshot I see <Constructor id="_161" name="S" context="_137" access="public" mangled="_ZN1SC1IS_EET_ *INTERNAL* " demangled="S::S<S>(S)" location="f1:3" file="f1" line="3" extern="1"> Is that difficult to fix? struct S { template <typename T> S(T); template <typename T> void h(T); }; S f(); void g() { S a( f() ); // does not instantiate member template } | ||||||||
| Tags | No tags attached. | ||||||||
| Attached Files | |||||||||
| Relationships | |
| Relationships |
| Notes | |
|
(0019708) Brad King (manager) 2010-03-04 11:36 |
If I change the example to struct S { template <typename T> S(T) { T().blah(); } template <typename T> void h(T); }; S f(); void g() { S a( f() ); // does not instantiate member template S b(static_cast<S*>(0)); // error } then I get an error at b() but not at a(). The GCC 4.2 parser that gcc-xml uses internally must be instantiating the interface long enough to figure out that it shouldn't use it, and then skip instantiating the body. However by that point it is too late to stop xml.c from seeing the instantiated declaration. I have no time to investigate this now. If you want to try I can get you started. |
|
(0019723) axel (reporter) 2010-03-05 04:24 |
Hi Brad, yes, can you send me a pointer what I should be looking at to work around this issue? I suppose I would simply explicitly suppress all copy constructor member templates. Cheers, Axel. |
|
(0019726) Brad King (manager) 2010-03-05 08:10 |
Look for the "xml_add_template_decl" function in "GCC/gcc/cp/xml.c" with in the source. |
|
(0038327) Brad King (manager) 2015-03-26 11:59 |
As announced here: [ANNOUNCE] GCC-XML maintenance moving to Github http://thread.gmane.org/gmane.comp.compilers.gccxml/731 [^] http://public.kitware.com/pipermail/gccxml/2015-March/003206.html [^] gccxml will no longer be developed by its original author, who will instead focus on CastXML: https://github.com/CastXML/CastXML#readme [^] The original GCC-XML issue tracker is now closed. In order to facilitate ongoing maintenance by community participants, issues will now be tracked on the Github repository page: https://github.com/gccxml/gccxml/issues [^] |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2010-03-04 09:43 | axel | New Issue | |
| 2010-03-04 11:34 | Brad King | Status | new => assigned |
| 2010-03-04 11:34 | Brad King | Assigned To | => Brad King |
| 2010-03-04 11:36 | Brad King | Note Added: 0019708 | |
| 2010-03-05 04:24 | axel | Note Added: 0019723 | |
| 2010-03-05 08:10 | Brad King | Note Added: 0019726 | |
| 2015-03-26 11:59 | Brad King | Note Added: 0038327 | |
| 2015-03-26 11:59 | Brad King | Status | assigned => resolved |
| 2015-03-26 11:59 | Brad King | Resolution | open => suspended |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |