public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56452] New: [C++11] Using declaration for inheriting constructors taints template parameter
@ 2013-02-26  1:30 lucdanton at free dot fr
  2013-02-26 18:05 ` [Bug c++/56452] " jason at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: lucdanton at free dot fr @ 2013-02-26  1:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56452

             Bug #: 56452
           Summary: [C++11] Using declaration for inheriting constructors
                    taints template parameter
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lucdanton@free.fr


Created attachment 29537
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29537
Minimal reproducible testcase

$ g++-snapshot --version
g++-snapshot (Debian 20130222-1) 4.8.0 20130223 (experimental) [trunk revision
196236]

$ cat main.cpp 
struct foo {
    explicit foo(int) {}
};

template<typename T>
struct bar: T {
    using T::T;

    // Bad
    explicit bar(): T(0) {}

    void baz()
    {
        // Also bad
        using qux = T;
    }
};

int main()
{}

$ g++-snapshot -std=c++11 -pthread main.cpp 
main.cpp: In constructor 'bar<T>::bar()':
main.cpp:10:21: error: 'using T::T' is not a non-static data member of 'bar<T>'
     explicit bar(): T(0) {}
                     ^
main.cpp: In member function 'void bar<T>::baz()':
main.cpp:15:21: error: expected type-specifier before 'T'
         using qux = T;
                     ^

---

If the using declaration is commented out, then things proceed as usual. It is
also possible to alias the template parameter before the using declaration
(e.g. using base_type = T;) to substitute for uses of T after the declaration.
Because this doesn't happen if bar is not a template, I don't think it is
intended.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/56452] [C++11] Using declaration for inheriting constructors taints template parameter
  2013-02-26  1:30 [Bug c++/56452] New: [C++11] Using declaration for inheriting constructors taints template parameter lucdanton at free dot fr
@ 2013-02-26 18:05 ` jason at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jason at gcc dot gnu.org @ 2013-02-26 18:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56452

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-26 18:04:27 UTC ---
Same issue as 56358.

*** This bug has been marked as a duplicate of bug 56358 ***


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-26 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26  1:30 [Bug c++/56452] New: [C++11] Using declaration for inheriting constructors taints template parameter lucdanton at free dot fr
2013-02-26 18:05 ` [Bug c++/56452] " jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).