Skip to content

<deque>,<vector>: Template nested use compile error #2945

Description

@66maer

Compiling the following scene with Visual Studio 2022, I get a compile error

I used C++17 inline static member variables

file: hello.hpp

#pragma once

#include <vector>
#include <deque>

template <typename T>
class MyQue {
    std::deque<T> que_;
};

class A{
    inline static MyQue<A> myque_;
};

file hello.cpp

#include "hello.h"

int main() {
    A a;
}

I found this weird problem with the following scenario

  1. compile directly (Everything is the default configuration Debug/x64/C++17)
  2. At this time, an error will be reported, an undefined type is used 'A'
  3. Change deque to vector, compile through std::deque<T> que_; ----->std::vector<T> que_;

I don't understand, why deque doesn't work properly

// in an experiment,If you do not clear the cache at this time and change back to deque, the compilation can still pass.

These codes can be compiled smoothly in linux gcc-9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions