[Bug c++/88979] New: [C++20] P0634R3 not working for constructor parameter types

19Sebastian95 at gmx dot de gcc-bugzilla@gcc.gnu.org
Tue Jan 22 14:35:00 GMT 2019


            Bug ID: 88979
           Summary: [C++20] P0634R3 not working for constructor parameter
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 19Sebastian95 at gmx dot de
  Target Milestone: ---

# gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/ --enable-languages=c,c++
Thread model: posix
gcc version 9.0.0 20190118 (experimental) (GCC) 

# Description: 
When compiling the following code and uncommenting the first constructor of A
it'll throw the error in the comment. 
The expected behaviour would either be "error: need 'typename' before 'T::type'
because 'T' is a dependent scope" or no error at all.

# Options: 
-O2 -std=c++2a -Wall -Wextra

# Source Code:
template<typename T>
class A {
    using type = T::type;
    /*A(T::type a) : mA{a} {}*/ // error: expected ')' before 'a'
    A(type a); // OK
    constexpr void a(T::type a) noexcept { // OK
        mA = a;
    [[nodiscard]] constexpr T::type a() const noexcept { // OK
        return mA;
    T::type mA; // OK

template<typename T>
A<T>::A(T::type a) : mA{a} {} // OK

struct B {
    using type = int;

int main() {
    A<B> a{20};
    return a.a();

More information about the Gcc-bugs mailing list