https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101740

            Bug ID: 101740
           Summary: The symbol "<" after a name follows "~" as an
                    id-expression of a member access expression should be
                    interpreted as a delimiter of template-argument-list
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xmh970252187 at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/qjv7vEoYc  

template<template<class> class T, class U>
struct Test{
    void fun(){
        T<U> d;
        d.~GG<int>();  // #1
    }
};
template<class >
struct GG{};
int main(){
  Test<GG,int> b;
  b.fun();
}

This example is accepted by Clang but is rejected by GCC. According to
[temp.names#3.1] 


> A < is interpreted as the delimiter of a template-argument-list if it follows 
> a name that is not a conversion-function-id and 
>> that follows the keyword template or a ~ after a nested-name-specifier or in 
>> a class member access expression, or ...


#1 is completely satisfied with the above rule, Hence the symbol "<" should be
interpreted as a delimiter of the template-argument-list instead of a less than
operator.
  • [Bug c++/101740] New: The symbo... xmh970252187 at gmail dot com via Gcc-bugs

Reply via email to