C++ Logo

std-discussion

Advanced search

Re: 2 big problems with User Defined literals:

From: Andy Little <kwikius_at_[hidden]>
Date: Thu, 6 May 2021 15:39:33 +0000 (UTC)
On Thursday, 6 May 2021, 15:10:01 BST, Jason McKesson via Std-Discussion <std-discussion_at_[hidden]> wrote:
> (even if the parser could do it)

Simple enough to test:

namespace test{}

int main()
{
  int x = test::1;
}

 Should get a syntax error and since there are no unknown constructs then that is a good indication the grammar is not ambiguous. Also a nice path there to replace the buiit-in types with one's own in future, thus putting UDTs' at the same level as builtin types

using my::int ;

int main()
{
   int x = 1 ; // x is a my::int
}

Received on 2021-05-06 10:39:42