deftemp03.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 22 行

C
22
字号
// 14.1p15: "When parsing a default template-argument for a non-type
// template-parameter, the first non-nested > is taken as the end of
// the template-parameter-list rather than a greater-than operator."

#include "fail.h"

template<int n = (1 > 2) >
struct X {
    int member;
    X( ) : member( n ) { }
};

int main()
{
    X<> object;

    if( object.member != 0 ) fail(__LINE__);


    _PASS;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?