Bug 56452 - [C++11] Using declaration for inheriting constructors taints template parameter
Summary: [C++11] Using declaration for inheriting constructors taints template parameter
Status: RESOLVED DUPLICATE of bug 56358
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-26 01:30 UTC by lucdanton
Modified: 2013-02-26 18:04 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Minimal reproducible testcase (152 bytes, text/x-c++src)
2013-02-26 01:30 UTC, lucdanton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lucdanton 2013-02-26 01:30:17 UTC
Created attachment 29537 [details]
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.
Comment 1 Jason Merrill 2013-02-26 18:04:27 UTC
Same issue as 56358.

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