【发布时间】:2019-11-09 18:42:11
【问题描述】:
下面的代码看似合理,但在两个主要编译器上都不起作用
#include <type_traits>
template<template<class> class Tmp>
struct S{
template<class T>
using tmp_t = Tmp<T>;
static_assert(std::is_same_v< S<tmp_t>, S<Tmp> >,
"Not same?? How come?");
};
template<class> struct Dummy{};
template struct S<Dummy>;
gcc 以 7.1 开头可以编译(https://godbolt.org/z/DjAcgP)
叮当(https://godbolt.org/z/ewBbZJ)
和
msvc (https://godbolt.org/z/6ZmQwj)
没有这样做
此代码符合标准吗?
【问题讨论】:
标签: c++ language-lawyer